Giter Site home page Giter Site logo

bdorlov / mitm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from synchronizing/mitm

0.0 0.0 0.0 28 KB

๐Ÿ‘จ๐Ÿผโ€๐Ÿ’ป A simple Python project that creates a man-in-the-middle proxy utilizing the Asyncio library.

License: MIT License

Python 100.00%

mitm's Introduction

๐Ÿ‘จ๐Ÿผโ€๐Ÿ’ป mitm: Man In The Middle

A simple Python project that creates a man-in-the-middle proxy utilizing the standard Asyncio library. This project allows you to intercept HTTP and HTTPS traffic via a simple proxy service.

img

This program does not utilize advance tactics like sslbump but rather a very primitive (and often prevented) method for HTTP/HTTPS tampering. To accomplish a man-in-the-middle attack with TLS support mitm will generate a self-signed key/certificate that will be utilized to talk back and forth with the client while simultaneously talking with the destination server. If you imagine a typical connection being:

client <-> server

This program will do the following:

client <-> mitm (server) <-> mitm (emulated client) <-> server

Where the client speaks with mitm (server) and on behalf of the client the mitm (emulated client) speaks to to the destination server. The HTTP/HTTPS request and response data is then captured in both pipes and transmitted back and forth while the requests and response are printed to the console.

This project was originally programmed for an advance public proxy management tool and not actually for reasons of exploit. I do caution those that wish to use this for harm, and do not condone the use of this software for such reasons. Use it at your own risk.

Requirements

  • You must have OpenSSL 1.1.1 or greater.
  • PyOpenSSL: Generate the SSL certificate and key.
  • term-color: Prettify the outputs.

Installing

Simply clone the project, install, and use.

$ git clone https://github.com/synchronizing/mitm
$ cd mitm
$ pip install .

Using

Initializing the proxy is fairly easy.

from mitm.server import ManInTheMiddle
import asyncio

mitm = ManInTheMiddle(host="127.0.0.1", port=8888)
asyncio.run(mitm.start())

Once the server is up and running you may either redirect any traffic to the proxy via explicit methods:

import requests
proxies = {"http": "127.0.0.1:8888", "https": "127.0.0.1:8888"}
requests.get("http://api.ipify.org?format=json", proxies=proxies, verify=False).text
requests.get("https://api.ipify.org?format=json", proxies=proxies, verify=False).text

Or implicit, via setting the environmental variables http_proxy and https_proxy, and then using requests or aiohttp without setting proxies.

export http_proxy=http://127.0.0.1:8888
export https_proxy=http://127.0.0.1:8888

Either way will work.

mitm's People

Contributors

synchronizing avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.