python-scripts/scripts/packet_sniffer/main.py
2022-10-08 14:11:19 +05:30

21 lines
374 B
Python

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()