Created
March 3, 2023 23:39
-
-
Save tcarrio/30271e03108d527bbdd5df4cd673e573 to your computer and use it in GitHub Desktop.
Python HTTP listener - Client IP logger
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
import http.server | |
import socketserver | |
class MyHandler(http.server.SimpleHTTPRequestHandler): | |
def handle_one_request(self): | |
print(self.client_address[0]) | |
return super().handle_one_request() | |
httpd = socketserver.TCPServer(("", 80), MyHandler) | |
while True: | |
httpd.handle_request() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment