Skip to content

Instantly share code, notes, and snippets.

@darxtrix
Created March 22, 2015 06:05
Show Gist options
  • Save darxtrix/d0594117596f22873a68 to your computer and use it in GitHub Desktop.
Save darxtrix/d0594117596f22873a68 to your computer and use it in GitHub Desktop.
Hook post
import SimpleHTTPServer
import SocketServer
import logging
import cgi
import sys
PORT = 8080
sys.stdout = open('log.txt','a')
count = 0
class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
#logging.error(self.headers)
SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
def do_POST(self):
print self
print '\n'
#logging.error(self.headers)
form = cgi.FieldStorage(
fp=self.rfile,
headers=self.headers,
environ={'REQUEST_METHOD':'POST',
'CONTENT_TYPE':self.headers['Content-Type'],
})
for item in form.list:
#logging.error(item)
print item
SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
Handler = ServerHandler
httpd = SocketServer.TCPServer(("0.0.0.0", PORT), Handler)
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment