Skip to content

Instantly share code, notes, and snippets.

@mlklm
mlklm / sockethttpsproxy.py
Last active August 29, 2015 14:26
Simple Http/Https socket server
# A simple http/https socket server
# to generate your certificates : openssl req -new -x509 -keyout /etc/ssl/localcerts/certificates.pem -out /etc/ssl/localcerts/certificates.pem -days 365 -nodes
# to start the server python3 sockethttpsproxy.py
__HOST__ = 'localhost'
__BASE_PORT__ = "1080"
__FRONTEND_PORT__ = int(__BASE_PORT__)
__BACKEND_PORT_SSL__ = int(__BASE_PORT__ + "1")
__BACKEND_PORT_HTTP__ = int(__BASE_PORT__ + "2")
__CERTS_FOLDER__ = "/etc/ssl/localcerts/"
__BUFFER_SIZE__ = 4096