如何設定mitmproxy攔截https?

如何設定mitmproxy攔截https?

我正在嘗試使用mitmproxy來調試一些https請求。我已配置mitmproxy為監聽某個連接埠:

mitmproxy --listen-port 44700

我已經正確配置了我的環境:

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

這適用於http

» http http://www.example.org

正如預期的那樣,正在擊中mitmproxy

Buuuthttps失敗了:

» 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)

問題:

  1. 我需要配置另一個連接埠來mitmproxy監聽嗎https
  2. 我如何告訴http(工具)信任mitmproxy CA

答案1

網路圖形使用者介面非常舒適。你可以用mitmproxy它代替。

  1. 運行代理伺服器 $mitmweb --listen-port 44700
    確保 44700 連接埠在防火牆中開啟。您可以使用標誌指定代理的IP --listen-host。如果無法遠端存取 --listen-host 192.168.0.10或嘗試IE 。--listen-host 0.0.0.0

  2. 在遠端設備中設定 IP 和連接埠代理程式。

  3. 在遠端設備中開啟瀏覽器並前往http://mitm.it,是本機 DNS 中的本機頁面,您可以下載並安裝憑證。
    如果是 Android,則必須指定 PIN 鎖定螢幕。

  4. 開啟 web gui,預設在瀏覽器中的連接埠 8081:http://127.0.0.1:8081/#/flows
    享受網路攔截。

答案2

配置您的設備代理的ip/端口,並打開http://mitm.it在瀏覽器上,選擇一個作業系統來安裝 CA。

更詳細的可以參考官方文檔

相關內容