Skip to content

Instantly share code, notes, and snippets.

@fagci
Created October 8, 2020 18:16
Show Gist options
  • Save fagci/c0c47b5b4a8c7fa324c1e453c4d518a4 to your computer and use it in GitHub Desktop.
Save fagci/c0c47b5b4a8c7fa324c1e453c4d518a4 to your computer and use it in GitHub Desktop.
Simple python HTTP sniffer
#!/usr/bin/python
import socket
HOST = socket.gethostbyname(socket.gethostname())
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP)
s.bind((HOST,0))
while True:
data=s.recvfrom(65535)
if 'Content-Type: text/html' in str(data[0][52:]):
print(data[0][52:].decode('ascii'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment