HTTP proxy logging daemon: a tcpdump-like, at HTTP level :)
Python
Latest commit c7c19b8 Nov 9, 2011 @nbareil adding output too
Permalink
Failed to load latest commit information.
README adding output too Nov 9, 2011
twisted-proxy.py twisted-proxy is alive! Nov 9, 2011

README

                            twisted-proxy


This daemon listens incoming HTTP requests, dumps it on output and relays
request to the final server.

It is useful for dumping URL, Headers and GET/POST variables that your
browser can make behind your back.

Screenshot
==========

  $ ./twisted-proxy.py --body -p 8888 -o /tmp/twisted-output.log &
  $ http_proxy=http://127.0.0.1:8888/ curl http://www.google.com/humans.txt
  $ cat /tmp/twisted-output.log
  >>> GET http://www.google.com/humans.txt
  >>> Accept-Language: en-US,en;q=0.8
  >>> Accept-Encoding: gzip,deflate,sdch
  >>> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  >>> User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.21 Safari/535.7
  >>> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  >>> Host: www.google.com
  >>> Cookie: PREF=ID=7e6ae28a62c12bbb:FF=0:TM=1320871562:LM=1320871562:S=hzpNjKoETHQPFtEA
  >>> Proxy-Connection: keep-alive
  >>>
  >>>
  <<< Vary Accept-Encoding
  <<< Content-Encoding gzip
  <<< Content-Type text/plain
  <<< Last-Modified Fri, 23 Sep 2011 00:58:54 GMT
  <<< Date Wed, 09 Nov 2011 20:47:56 GMT
  <<< Expires Wed, 09 Nov 2011 20:47:56 GMT
  <<< Cache-Control private, max-age=0
  <<< X-Content-Type-Options nosniff
  <<< Server sffe
  <<< Content-Length 203
  <<< X-XSS-Protection 1; mode=block

  "\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff%PA\x92\xc30\x08\xbb\xef+t\xdbK'}\xc6N\x9fAl\xe2\xd08\xd01x:\xf9\xfd:\xc9I \x18I\xf0gV*C\x1cs\x97\x1a\x98\x0f\x10*\xb5\xc2\x08\xa6\x1d\xb6\x80\xb5\x8827\x7f \xb3K\xd1\xabl\xecL-\xadwc\xb3\xc5@\xd2\x0c\x8b\x93\x83(v\xd2\x03Y\x96\x85\x1bk\xc0%\xd8A\xa9\x99;\xc6\x12J\xb5\x99'\xbc\xe2\xb4\xef\x9fL\xc1\x19\xc94D\xbbu\xaf\xc7-x\x07\xfbJ\xac\xd8\xad\x8d\\f\xd5\xafIpZ\xd5\xaa\x15\xe1S\x91\x14_F\x1a\xe0+m<\x0e\xf1\x90\xb4\x81b\x98,8\xac\xfffT\xd9N\t\xac\\?\xe8\x0e\xeb\xf1\x80\xf3Hs}bJ\xb6?\xdf6\xfb\xf4\xf3\x0f2)\xc9\xfd\x1b\x01\x00\x00"



Usage
=====

  $ ./twisted-proxy.py -h
  Usage: twisted-proxy.py [options]
  
  Options:
    -h, --help            show this help message and exit
    -o FILE, --output=FILE
                          Redirect output
    -b, --body            Print response body (can be large!)
    -v, --verbose         verbose mode
    -p PORT, --port=PORT  Listening port
    -a ADDRESS, --addr=ADDRESS
                          Bind address (WARNING: Do not expose this daemon on
                          Internet)