Friday, 15 March 2013

python - How to filter by ethernet MAC address -



python - How to filter by ethernet MAC address -

the next code:

sniff(filter = "dst aa:bb:cc:dd:ee" )

throws error because sniff expecting ip, not mac.

so how supposed filter mac?

what specyfing lfilter sniff ?

zzz = sniff(lfilter=lambda d: d.src == 'aa:bb:cc:dd:ee:ff')

dst , src attributes of sniffed message.

have posted reply stop_filter specified. suppose wouldn't work you, since scapy stop after receving first packet match mac address stop_filter. lfilter should job. sendrecv.py:

lfilter: python function applied each packet determine if farther action may done ex: lfilter = lambda x: x.haslayer(padding)

python scapy packet-sniffers

No comments:

Post a Comment