Created
October 8, 2020 18:16
-
-
Save fagci/c0c47b5b4a8c7fa324c1e453c4d518a4 to your computer and use it in GitHub Desktop.
Simple python HTTP sniffer
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
#!/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