22 lines
461 B
Python
22 lines
461 B
Python
from scapy.all import *
|
|
import http.server
|
|
import socketserver
|
|
import threading
|
|
|
|
PORT = 80
|
|
|
|
Handler = http.server.SimpleHTTPRequestHandler
|
|
http = socketserver.TCPServer(("", PORT), Handler)
|
|
|
|
def handler(pkt):
|
|
print(pkt)
|
|
|
|
def sniff_packets():
|
|
sniff(filter=f"tcp port {PORT}", prn=handler)
|
|
|
|
if __name__ == "__main__":
|
|
sniffer = threading.Thread(target=sniff_packets)
|
|
sniffer.start()
|
|
http.serve_forever()
|
|
print("serving at port", PORT)
|
|
|