Skip to content

Instantly share code, notes, and snippets.

@cgimenes
Last active August 3, 2020 20:36
Show Gist options
  • Save cgimenes/d51ce87cfbb11977c50ecf2c6e7fb5cc to your computer and use it in GitHub Desktop.
Save cgimenes/d51ce87cfbb11977c50ecf2c6e7fb5cc to your computer and use it in GitHub Desktop.
Simple HTTP server for session hijacking PoCs
#!/usr/bin/env python
from http.server import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
print(self.headers)
self.send_response(204)
def do_POST(self):
print(self.headers)
length = int(self.headers['content-length'])
body = self.rfile.read(length)
self.send_response(204)
self.end_headers()
print(body)
def main():
port = 8080
print('Listening on localhost:%s' % port)
server = HTTPServer(('', port), RequestHandler)
server.serve_forever()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment