Created
January 31, 2023 10:24
-
-
Save jwhb/de4225afba72328af443671177666ec5 to your computer and use it in GitHub Desktop.
python3 HTTP inspection
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
#!/usr/bin/python3 | |
import http.server | |
import socketserver | |
import logging | |
PORT=8000 | |
class ServerHandler(http.server.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
logging.error(self.headers) | |
# whatever else you would like to log here | |
http.server.SimpleHTTPRequestHandler.do_GET(self) | |
Handler = ServerHandler | |
with socketserver.TCPServer(("", PORT), Handler) as httpd: | |
print("serving at port", PORT) | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment