Search code examples
network-programmingproxymitmproxy

How to capture or view SMTP and other non HTTP traffic in proxy application?


I am using mitmproxy. I want to view all traffic to and from my machine. Default proxy setting allows to see only HTTP traffic.


Solution

  • Starting with mitmproxy 7 (unreleased, development snapshots are available at the time of writing), raw TCP is captured by default and protocols with server-side greetings are finally supported. Here is an example:

    $ mitmproxy --mode reverse:http://smtp.gmail.com:25 --set connection_strategy=eager
    

    and then in another console window:

    $ nc localhost 8080
    220 smtp.gmail.com ESMTP d15sm920969edx.62 - gsmtp
    

    Note that this is for a development snapshot, so still subject to change. In particular, we may enable connection_strategy=eager by default. :-)