美文网首页
mitmproxy 代理

mitmproxy 代理

作者: 王国的荣耀 | 来源:发表于2020-08-26 19:53 被阅读0次

    安装mitmproxy

    pip install mitmproxy
    Requirement already satisfied: mitmproxy in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (5.2)
    Requirement already satisfied: click<8,>=7.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (7.1.2)
    Requirement already satisfied: cryptography<3.0,>=2.9 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (2.9.2)
    Requirement already satisfied: urwid!=2.1.0,==2.0.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (2.0.1)
    Requirement already satisfied: kaitaistruct<0.9,>=0.7 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (0.8)
    Requirement already satisfied: hyperframe<6,>=5.1.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (5.2.0)
    Requirement already satisfied: wsproto<0.16,>=0.14 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (0.15.0)
    Requirement already satisfied: blinker<1.5,>=1.4 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (1.4)
    Requirement already satisfied: zstandard<0.14,>=0.11 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (0.13.0)
    Requirement already satisfied: sortedcontainers<2.2,>=2.1.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (2.1.0)
    Requirement already satisfied: passlib<1.8,>=1.6.5 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (1.7.2)
    Requirement already satisfied: flask<1.2,>=1.1.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (1.1.2)
    Requirement already satisfied: pyperclip<1.9,>=1.6.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (1.8.0)
    Requirement already satisfied: certifi>=2019.9.11 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (2020.6.20)
    Requirement already satisfied: pyparsing<2.5,>=2.4.2 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (2.4.7)
    Requirement already satisfied: tornado<7,>=4.3 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (6.0.4)
    Requirement already satisfied: ruamel.yaml<0.17,>=0.16 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (0.16.10)
    Requirement already satisfied: h2<4,>=3.2.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (3.2.0)
    Requirement already satisfied: protobuf<3.12,>=3.6.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (3.11.3)
    Requirement already satisfied: pyasn1<0.5,>=0.3.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (0.4.8)
    Requirement already satisfied: publicsuffix2<3,>=2.20190812 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (2.20191221)
    Requirement already satisfied: ldap3<2.8,>=2.6.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (2.7)
    Requirement already satisfied: pyOpenSSL<19.2,>=19.1.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (19.1.0)
    Requirement already satisfied: Brotli<1.1,>=1.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from mitmproxy) (1.0.7)
    Requirement already satisfied: cffi!=1.11.3,>=1.8 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from cryptography<3.0,>=2.9->mitmproxy) (1.14.2)
    Requirement already satisfied: six>=1.4.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from cryptography<3.0,>=2.9->mitmproxy) (1.15.0)
    Requirement already satisfied: h11>=0.8.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from wsproto<0.16,>=0.14->mitmproxy) (0.10.0)
    Requirement already satisfied: Werkzeug>=0.15 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from flask<1.2,>=1.1.1->mitmproxy) (1.0.1)
    Requirement already satisfied: itsdangerous>=0.24 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from flask<1.2,>=1.1.1->mitmproxy) (1.1.0)
    Requirement already satisfied: Jinja2>=2.10.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from flask<1.2,>=1.1.1->mitmproxy) (2.11.2)
    Requirement already satisfied: ruamel.yaml.clib>=0.1.2; platform_python_implementation == "CPython" and python_version < "3.9" in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from ruamel.yaml<0.17,>=0.16->mitmproxy) (0.2.0)
    Requirement already satisfied: hpack<4,>=3.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from h2<4,>=3.2.0->mitmproxy) (3.0.0)
    Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from protobuf<3.12,>=3.6.0->mitmproxy) (47.1.0)
    Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from cffi!=1.11.3,>=1.8->cryptography<3.0,>=2.9->mitmproxy) (2.20)
    Requirement already satisfied: MarkupSafe>=0.23 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from Jinja2>=2.10.1->flask<1.2,>=1.1.1->mitmproxy) (1.1.1)
    

    mitmproxy 快捷键

    mitmproxy的操作
    链接列表

    按键 说明
    q 退出(相当于返回键,可一级一级返回)
    d 删除当前(黄色箭头)指向的链接
    D 恢复刚才删除的请求
    G 跳到最新一个请求
    g 跳到第一个请求
    C 清空控制台(C是大写)
    i 可输入需要拦截的文件或者域名(逗号需要用\来做转译,栗子:feezu.cn)
    a 放行请求
    A 放行所有请求
    ? 查看界面帮助信息
    ^ v 上下箭头移动光标
    enter 查看光标所在列的内容
    tab 分别查看 Request 和 Response 的详细信息
    / 搜索body里的内容
    esc 退出编辑
    e 进入编辑模式

    安装证书

    1. 设置代理
    2. safari 手机下载证书:在手机浏览器输入mitm.it选择适合自己操作系统的证书,我这里是apple的,就是选择的apple的。设置完成后需要信任这个证书,设置->通用->关于本机->证书信任设置。针对根证书启用完全信任打开,就完成了。
    3. mitmproxy
    4. MitmWeb
    image.png

    MitmWeb 页面

    image.png

    设置对应的端口到8888

    MitmWeb -p 8888

    mitmdump -s script.py -p 8888

    相关文章

      网友评论

          本文标题:mitmproxy 代理

          本文链接:https://www.haomeiwen.com/subject/wfpfsktx.html