Skip to content

Instantly share code, notes, and snippets.

@tcarrio
Created March 3, 2023 23:39
Show Gist options
  • Save tcarrio/30271e03108d527bbdd5df4cd673e573 to your computer and use it in GitHub Desktop.
Save tcarrio/30271e03108d527bbdd5df4cd673e573 to your computer and use it in GitHub Desktop.
Python HTTP listener - Client IP logger
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