Skip to content

Instantly share code, notes, and snippets.

View corrupt's full-sized avatar

corrupt corrupt

View GitHub Profile
@willnix
willnix / custom_http.py
Last active May 17, 2019 11:14
Slightly customized Python 3 HTTP Server
#!/usr/bin/env python3
from http.server import SimpleHTTPRequestHandler, HTTPServer
class CustomHTTPRequestHandler(SimpleHTTPRequestHandler):
def do_GET(self):
'''
Print request and call SimpleHTTPRequestHandler.do_GET()
to serve static files
'''
print(">"+"-"*40+"<")
@llekn
llekn / http-stdout-echo.py
Last active January 7, 2024 23:35
HTTP server that print what is requested to console. Useful for debugging purposes.
#!/usr/bin/env python3
'''Usage:
python3 http-stdout-echo.py -a <bind-address> -p <bind-port>
Examples:
python3 http-stdout-echo.py # (will listen at 127.0.0.1:8080 by default)
python3 http-stdout-echo.py -a 10.3.1.3 -p 5555'''
from http.server import HTTPServer, BaseHTTPRequestHandler