Giter Site home page Giter Site logo

proxy2's Introduction

proxy2

HTTP/HTTPS proxy in a single python script

Features

  • easy to customize
  • require no external modules
  • support both of IPv4 and IPv6
  • support HTTP/1.1 Persistent Connection
  • support dynamic certificate generation for HTTPS intercept

This script works on Python 2.7. You need to install OpenSSL to intercept HTTPS connections.

Usage

Just run as a script:

$ python proxy2.py

Above command runs the proxy on tcp/8080. To use another port, specify the port number as the first argument.

$ python proxy2.py 5000

Enable HTTPS intercept

To intercept HTTPS connections, generate private keys and a private CA certificate:

$ ./setup_https_intercept.sh

Through the proxy, you can access http://proxy2.test/ and install the CA certificate in the browsers.

Customization

You can easily customize the proxy and modify the requests/responses or save something to the files. The ProxyRequestHandler class has 3 methods to customize:

  • request_handler: called before accessing the upstream server
  • response_handler: called before responding to the client
  • save_handler: called after responding to the client with the exclusive lock, so you can safely write out to the terminal or the file system

By default, only save_handler is implemented which outputs HTTP(S) headers and some useful data to the standard output.

proxy2's People

Contributors

inaz2 avatar mre avatar

Watchers

 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.