mitmproxy | interactive TLS-capable intercepting HTTP proxy | HTTP library

 by   mitmproxy Python Version: 10.2.4 License: MIT

kandi X-RAY | mitmproxy Summary

kandi X-RAY | mitmproxy Summary

mitmproxy is a Python library typically used in Networking, HTTP applications. mitmproxy has no bugs, it has no vulnerabilities, it has a Permissive License and it has high support. However mitmproxy build file is not available. You can install using 'pip install mitmproxy' or download it from GitHub, PyPI.

mitmproxy is an interactive, SSL/TLS-capable intercepting proxy with a console interface for HTTP/1, HTTP/2, and WebSockets. mitmdump is the command-line version of mitmproxy. Think tcpdump for HTTP. mitmweb is a web-based interface for mitmproxy.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              mitmproxy has a highly active ecosystem.
              It has 31289 star(s) with 3723 fork(s). There are 618 watchers for this library.
              There were 10 major release(s) in the last 6 months.
              There are 258 open issues and 2797 have been closed. On average issues are closed in 75 days. There are 27 open pull requests and 0 closed requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of mitmproxy is 10.2.4

            kandi-Quality Quality

              mitmproxy has 0 bugs and 0 code smells.

            kandi-Security Security

              mitmproxy has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              mitmproxy code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              mitmproxy is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              mitmproxy releases are available to install and integrate.
              Deployable package is available in PyPI.
              mitmproxy has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions are available. Examples and code snippets are not available.
              mitmproxy saves you 58386 person hours of effort in developing the same functionality from scratch.
              It has 64603 lines of code, 4099 functions and 776 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed mitmproxy and discovered the below as its top functions. This is intended to give you an instant insight into mitmproxy implemented functionality, and help decide if they suit your requirements.
            • Draw the screen
            • Convert an attributespec to an escape string
            • Sets up the G1 flag
            • Get the last row in the row
            • Format a Flow
            • Colorize a host
            • Format a DNS flow
            • Extract fields from packed fields
            • Reads a variable length integer from the given data
            • Parse the incoming packet
            • Start the connection
            • Get a single input
            • Read fields from wire data
            • Handle key press events
            • Process a received handshake data
            • Display the user interface
            • Make quick help dialog
            • Create HTML widgets for an HTTP Flow table
            • Render flow details
            • Styles text
            • Dump information about the process
            • Record the interception requests
            • Format a urwid widget
            • Receive messages from an event
            • Handle an event
            • Record modify requests
            Get all kandi verified functions for this library.

            mitmproxy Key Features

            No Key Features are available at this moment for mitmproxy.

            mitmproxy Examples and Code Snippets

            启动一个remote mitmproxy
            Javadot img1Lines of Code : 41dot img1no licencesLicense : No License
            copy iconCopy
            	/**
            	 * 启动一个Remote Mitmproxy 
            	 * @param mitmproxyHubAddr mitmproxy-hub服务的ip,不知道mitmproxy-hub是什么请看https://github.com/CreditTone/mitmproxy-hub
            	 * @param mitmproxyHubPort mitmproxy-hub服务的端口 
            	 * @param remoteBind       在mitmproxy-hub这个机器上启动一个mitmprox  
            Locust.Replay,New MITMProxy,Legacy MITMProxy
            Pythondot img2Lines of Code : 35dot img2no licencesLicense : No License
            copy iconCopy
            from locust import HttpLocust, TaskSet, task
            
            class UserBehavior(TaskSet):
                def on_start(self):
                    ''' on_start is called when a Locust start before any task is scheduled '''
                    self.www_google_com_1461888928_75()
            
                @task()
                def ww  
            majsoul_wrapper,使用说明,开启mitmproxy
            Pythondot img3Lines of Code : 14dot img3License : Permissive (MIT)
            copy iconCopy
            $pip install mitmproxy
            $mitmdump --version
            
            $mitmdump -s addons.py
            
            $python3 -m majsoul_wrapper
            
            $pip install selenium
            
            import pickle
            from xmlrpc.client import ServerProxy
            
            server = ServerProxy("http://127.0.0.1:37247")   # 初始化服务器
            n = server.get_len(  
            How do I modify the JSON Body in a POST request with mitmproxy?
            Pythondot img4Lines of Code : 8dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            def request(flow: http.HTTPFlow) -> None:
                # this is executed after we have received the request 
                # from the client, but before it is sent to the server.
            
            def response(flow: http.HTTPFlow) -> None:
                # this is executed after
            mitmproxy: Replace response by resubmitted request
            Pythondot img5Lines of Code : 24dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            def response(self, flow: http.HTTPFlow):
            
                m = re.search('localhost.local:8085/test/index.php/(.+?)" method=', str(flow.response.content))
                if m:
                    self.nextToken = m.group(1)
                    ctx.log.info("Next token: " + self.nextToke
            Select substring based on first match, requiring an earlier 2nd pattern match too
            Pythondot img6Lines of Code : 27dot img6License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            import re
            
            input = '''
            {\n  "log": {\n
            \n     "version": "0.1",\n  "GET": "TestAPIurlFoo" },
            \n   "entries": [\n  {\n
            \n     "sessionId": "sessionIdFoo",\n  "request": {\n "method": "POST",\n ...
            {\n  "log": {\n
            \n      "version": "0.1",\n
            run mitmproxy-node inside of a Docker container?
            Pythondot img7Lines of Code : 21dot img7License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            FROM node:14.15.0-buster
            WORKDIR /usr/src/app
            
            RUN apt-get update || : && apt-get install python3 -y -V
            ENV PATH="${PATH}:/usr/bin/python3"
            
            RUN apt-get install python3-pip -y -V
            RUN pip3 install mitmproxy
            ENV PATH="${PATH}:/usr/bi
            Python PyQt5 Add List Item from another Py-File
            Pythondot img8Lines of Code : 151dot img8License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            from functools import cached_property
            
            from PyQt5 import QtCore, QtRemoteObjects, QtWidgets
            
            
            class Bridge(QtCore.QObject):
                messageChanged = QtCore.pyqtSignal(str)
            
                @QtCore.pyqtSlot(str)
                def add_message(self, message):
                    
            Where has the websocket.inject_message method gone?
            Pythondot img9Lines of Code : 6dot img9License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            def websocket_message(flow):
                last_message = flow.websocket.messages[-1]
                if b"secret" in last_message.content:
                    last_message.kill()
                    ctx.master.commands.call("inject", [flow], not last_message.from_client, "ssssssh")
            <
            how to simulate timeout in mitmproxy addon?
            Pythondot img10Lines of Code : 3dot img10License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
                    flow.kill()
                    flow.client_conn.error = "Connection killed by an addon."
            

            Community Discussions

            QUESTION

            How to listen to GET and POST requests for all connections using GO
            Asked 2022-Mar-02 at 09:37

            I am using python and mitmproxy to listen to all incoming and outgoing traffic so that I can capture the URLs. I run the script and it tells me all URLs my computer is trying to connect to.

            I need to implement the same using Go but have not got a clue on how to start or what package to use. Can anyone guide me in the right direction please?

            Thanks

            ...

            ANSWER

            Answered 2022-Feb-27 at 14:39

            You would need a local intermediate proxy, in order to capture its traffic and display the URLs used.

            See for example, in Go, sipt/shuttle, with its GUI web interface:

            Source https://stackoverflow.com/questions/71285174

            QUESTION

            Trusting individual invalid certs in mitmproxy
            Asked 2022-Mar-02 at 07:37

            I use mitmproxy to gather intel from outbound AS2 (HTTP) requests leaving our network. The schema goes like this:

            ...

            ANSWER

            Answered 2022-Mar-02 at 07:37

            It's been a while since I've tried to solve this using a custom addon and it seems to work fine so I'll share it here:

            https://gist.github.com/jsmucr/24cf0859dd7c9bba8eb2817d7b0bf4b6

            This approach has a bit of disadvantage and that's the fact that it doesn't check if the peer certificate changes.

            Source https://stackoverflow.com/questions/70515761

            QUESTION

            How do I modify the JSON Body in a POST request with mitmproxy?
            Asked 2022-Jan-26 at 07:05

            I am working with an app that sends data to a server with a POST request,

            ...

            ANSWER

            Answered 2022-Jan-25 at 21:55

            You're altering the flow variable in a function, but not using the edited flow. If you return the new flow you can then use it and post it.

            Source https://stackoverflow.com/questions/70856089

            QUESTION

            Mitmproxy script returns "OSError: [Errno 63] File name too long" when XML response is read
            Asked 2022-Jan-21 at 00:47

            I have a simple "mitmproxy" script which should modify the response's XML body. But it seems that the XML body too large because I got the following error "OSError: [Errno 63] File name too long: '

            ...

            ANSWER

            Answered 2022-Jan-21 at 00:47

            It looks like ET.parse expects a filename, not the contents of the file.

            Source https://stackoverflow.com/questions/70790476

            QUESTION

            mitmproxy: Replace response by resubmitted request
            Asked 2022-Jan-19 at 17:24

            I try to replace a response in mitmproxy by the result of resubmitting the same request again. This is my current script:

            ...

            ANSWER

            Answered 2022-Jan-19 at 17:24

            Accidentally (more or less) I found a basic concept for an OAuth addon on github, which does exactly what I was looking for: oauth-mitmproxy

            So the code would look like this:

            Source https://stackoverflow.com/questions/70265469

            QUESTION

            Select substring based on first match, requiring an earlier 2nd pattern match too
            Asked 2021-Nov-17 at 02:02

            I'm trying to pull a specific Session ID from some very messy log files and even looking at other examples am having a hard time implementing any regular expressions that appear to work. The logs come in reading like this, and I am trying to collect the specific SessionId that appears after a given an earlier string is found for the first time "TestAPIurl"

            ...

            ANSWER

            Answered 2021-Nov-17 at 00:18

            Here is a regular expression that will return the value of the sessionId key.

            Source https://stackoverflow.com/questions/69997551

            QUESTION

            mitmdump error: too many file descriptors in select() issue in windows
            Asked 2021-Nov-04 at 11:43

            I try to capture requests on Android applications using mitmdump and python script, but mitmdump seems to be easily blocked and throws the following error:

            ...

            ANSWER

            Answered 2021-Nov-04 at 11:43

            The latest development releases (what will eventually be 8.0) use the ProactorEventLoop on Windows, which fixes this issue.

            For now you can either have fewer concurrent connections, or upgrade to the development snapshots.

            Source https://stackoverflow.com/questions/69835994

            QUESTION

            How to see the traffic of all applications with mitmproxy in Android?
            Asked 2021-Sep-02 at 14:43

            I added the certificate

            There is no problem in the browser, but it has no effect on applications

            I searched for this problem and realized that it seems that the Google update has caused this to happen

            In the description for Android it is written:

            Warning: Apps that target Android API Level 24 (introduced in 2016) and above only accept certificates from the system trust store (#2054). User-added CAs are not accepted unless the application manually opts in. Except for browsers, you need to patch most apps manually.

            But with all the explanations and cases I searched, I still did not understand what I should do to solve this problem

            I want to be able to see the traffic of all the programs

            ...

            ANSWER

            Answered 2021-Sep-02 at 14:43

            Unfortunately there is no universal solution to bypass certificate pinning.

            https://docs.mitmproxy.org/stable/concepts-certificates/#certificate-pinning lists a bunch of tools that can help with this, for example:

            • apk-mitm is a CLI application that automatically removes certificate pinning from Android APK files.
            • objection is a runtime mobile exploration toolkit powered by Frida, which supports certificate pinning bypasses on iOS and Android.

            Source https://stackoverflow.com/questions/69032367

            QUESTION

            mitmproxy to export web traffic as JSON
            Asked 2021-Aug-22 at 13:48

            Trying to save the captured web traffic of the raw HTTP request/response while using mitmproxy:

            ANSWER

            Answered 2021-Aug-22 at 13:48

            Mitmproxy currently has no JSON export. We're tentatively planning to support HAR export soon though. There's a community-contributed example for this here, which I think is in better shape than the jsondump one: https://github.com/mitmproxy/mitmproxy/blob/main/examples/contrib/har_dump.py

            Source https://stackoverflow.com/questions/68877443

            QUESTION

            How can I specify a map_remote rule in mitmproxy to redirect from a remote HTTPS URL to an HTTP URL?
            Asked 2021-Aug-04 at 15:21

            I'd like to set up a map_remote rewrite from an https address to my local machine running a service on http only.

            The documentation for the option (https://docs.mitmproxy.org/stable/concepts-options/) seems to indicate I should do this

            mitmproxy --map-remote "|https://foo.bar.com|http://localhost:8081|"

            But this doesn't seem to rewrite any requests.

            What's the correct syntax to accomplish this?

            ...

            ANSWER

            Answered 2021-Aug-04 at 15:21

            The problem in your example is the trailing |. Map Remote specifications can either be:

            • |flow-filter|url-regex|replacement or
            • |url-regex|replacement

            By append a final | to your two-part spec, you inadvertedly use the first form, and https://foo.bar.com is applied as the filter and not as the url regex. Long story short:

            Source https://stackoverflow.com/questions/68648389

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install mitmproxy

            The installation instructions are here. If you want to install from source, see CONTRIBUTING.md.

            Support

            General information, tutorials, and precompiled binaries can be found on the mitmproxy website.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install mitmproxy

          • CLONE
          • HTTPS

            https://github.com/mitmproxy/mitmproxy.git

          • CLI

            gh repo clone mitmproxy/mitmproxy

          • sshUrl

            git@github.com:mitmproxy/mitmproxy.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular HTTP Libraries

            requests

            by psf

            okhttp

            by square

            Alamofire

            by Alamofire

            wrk

            by wg

            mitmproxy

            by mitmproxy

            Try Top Libraries by mitmproxy

            pdoc

            by mitmproxyPython

            pathod

            by mitmproxyPython

            android-unpinner

            by mitmproxyPython

            netlib

            by mitmproxyPython

            mitmproxy_rs

            by mitmproxyRust