Created
March 22, 2015 06:05
-
-
Save darxtrix/d0594117596f22873a68 to your computer and use it in GitHub Desktop.
Hook post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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