this is a packet sniffer tool that I'm developing, however, my code works well and prints all sniffed data, but when I use the HTTPRequest if statement, it doesn't run, nor does it give me any errors, it just does nothing at all. However, if I remove the if statement it works, what is the reason for this?
Code:
#!usr/bin/env python
import scapy.all as scapy
from scapy.layers import http
def sniff(interface):
scapy.sniff(iface=interface, store=False, prn=process_sniffed_packet) # , filter="udp")
def process_sniffed_packet(packet):
if packet.haslayer(http.HTTPRequest):
print(packet.show())
sniff("wlan0")