How to configure mitmproxy to intercept https?

13,809

The web gui is very comfortable. You can use mitmproxy instead.

  1. Run the proxy server $ mitmweb --listen-port 44700
    Make sure that 44700 port is open in firewall. You can specify the IP of proxy with --listen-host flag. I.E. --listen-host 192.168.0.10 or try --listen-host 0.0.0.0 if can not access remotely.

  2. Configure in the remote device the IP and port proxy.

  3. Open browser in the remote device and go to http://mitm.it, is a local page, in a local DNS, that you can download and install the certs.
    If android, you must specify a pin lock screen.

  4. Open web gui, by default in port 8081 in your browser: http://127.0.0.1:8081/#/flows
    Enjoy networks intercepts.

Share:
13,809
Grég
Author by

Grég

Updated on September 18, 2022

Comments

  • Grég
    Grég over 1 year

    I am trying to use mitmproxy to debug some https requests. I have configured mitmproxy to listen to a certain port:

    mitmproxy --listen-port 44700
    

    I have configured my environment properly:

    export http_proxy=http://localhost:44700
    export https_proxy=https://localhost:44700
    

    And this is working for http:

    » http http://www.example.org
    

    is hitting mitmproxy, as expected.

    Buuut https is failing:

    » http https://www.example.org
    Traceback (most recent call last):
      File "/usr/bin/http", line 9, in <module>
        load_entry_point('httpie==0.9.2', 'console_scripts', 'http')()
      File "/usr/lib/python2.7/dist-packages/httpie/core.py", line 186, in main
        error('%s: %s', type(e).__name__, str(e))
    TypeError: __str__ returned non-string (type Error)
    

    Questions:

    1. Do I need to configure another port in mitmproxy to listen to https?
    2. How do I tell http (the tool) to trust the mitmproxy CA?
  • Federico Galli
    Federico Galli almost 6 years
    this doesn't look like a valuable answer