python-scripts/scripts/packet_sniffer/main.py

21 lines
374 B
Python
Raw Normal View History

2022-10-08 08:41:19 +00:00
import scapy.all as scapy
from scapy.layers import http
def sniffing(interface):
scapy.sniff(iface=interface,
storage=False, prn=process_packet, filter='tcp')
def process_packet(packet):
if packet.haslayer(http.HTTPRequest):
print(packet[http.HTTPRequest].Host)
def main():
sniffing("Wi-Fi")
if __name__ == "__main__":
main()