Quick tiny python web proxy

Posted: April 14, 2013 in MemoToSelf
Tags: , ,

Python just keeps amazing me, the following code is all you need to have a proxy up and running in like 10 seconds


from flask import Flask
from flask import request

import requests

app = Flask(__name__)

hosttorequest = 'www.cnn.com'

def root():
    r = requests.get('http://'+hosttorequest+'/')
    return r.content

def other(other):
    r = requests.get('http://'+hosttorequest+'/'+other)
    return r.content
if __name__ == '__main__':
    app.run(host='', port=80)

Now this sure makes it easy to start hiding some stuff in there. To get it up and running just do: sudo python filename.py

  1. diablohorn says:

    I’d guess it depends on the location from which the javascript is obtained. Using a proxy like burp or maybe using wireshark you should be able to debug where it goes wrong.

  2. Ray says:

    thats real cool thank you.

    Only it doesnt seems to deliver Javascript etc.

    How can we implement that?

  3. Marcos says:

    Amazing idea.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.