Mitmproxy Usage
v20141216 @3D
Question
• Debug API Request / Response
• Replay API Request / Response
Workflow
APP
Device
Proxy
Proxy
Install Mitmproxy
• apt-get install mitmproxy
• mitmproxy -p 3128
View Request
Question
• Japa / Titan / Vienna / Mandala? Which to use?
• Hybrid!
Workflow
APP
Device
Proxy
Proxy
Nginx
Hybrid
Japa etc…Titan
Get hybrid nginx
• svn checkout svn://devbox.in/trunk/conf/nginx
• cd /etc/nginx/
• ln -s ~/nginx/log_format.conf /etc/nginx/conf.d/
• ln -s ~/nginx/servers/hybrid.conf /etc/nginx/my_conf.d/
• cp ~/nginx/servers/www.duitang.com.conf sites-enabled/
• cp ~/nginx/servers/backend_product.conf .
• sed -i 's/ssl.*$//g' sites-enabled/www.duitang.com.conf
• sed -i 's/servers/hybrid/my_conf.d/hybrid/g' sites-enabled/www.duitang.com.conf
• sed -i 's/proxy_pass.*/proxy_pass http://p.s.duitang.com;/g' backend_product.conf
• sed 's/limit_req.*//g' backend_product.conf
• mkdir -p /duitang/logs/usr/nginx/
Mitmproxy script
# coding=utf-8
def request(context, flow):
if 'www.duitang.com' in flow.request.host:
if flow.request.scheme == "http":
flow.request.host = "127.0.0.1"
flow.request.port = 80
## mitmproxy -p 3128 -s ~path/mitm_lo_nginx.py
Links
• https://mitmproxy.org/ (GFW fucked)
• http://wiki.nginx.org/Main

Mitmproxy usage v20141216