Created
June 5, 2020 16:30
-
-
Save ertugrulturan/dbc5e66f22d955337877c6da56615132 to your computer and use it in GitHub Desktop.
[PY] Testing firewall
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
from http.server import HTTPServer, BaseHTTPRequestHandler | |
from socketserver import ThreadingMixIn | |
from requests import get, post | |
class RequestHandler(BaseHTTPRequestHandler): | |
def do_POST(self): | |
print(self.client_address[0]) # prints ip I think; start building from here | |
"""you can inspect the request, save its ip address maybe and then | |
make a POST request with the requests library and return the result""" | |
# if needed, same logic as above | |
def do_GET(self): | |
pass | |
class ThreadingHTTPServer(ThreadingMixIn, HTTPServer): | |
pass | |
address = (ip, port) | |
server = ThreadingHTTPServer(address, MyRequestHandler) | |
server.server_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reverse Proxy Module add: https://www.sipios.com/blog-tech/a-simple-reverse-proxy-in-python