how to ping broadcast mac address with specific interface using scapy?

Viewed 410

I would like to ping with scapy a specific interface when sending broadcast MAC.

please help me

>>>ans, unans = srp1(Ether(dst="ff:ff:ff:ff:ff:ff")/IP(dst="192.168.1.0/24")/ICMP(),timeout=2)

GOT

Received 1186 packets, got 1 answers, remaining 255 packets
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ValueError: not enough values to unpack (expected 2, got 1)

THEN RUN

>>>ans.summary(lambda s,r: r.sprintf("%Ether.src% %ARP.psrc%") )
1 Answers

srp1 only return the first answer

ans = srp1(Ether(dst="ff:ff:ff:ff:ff:ff")/IP(dst="192.168.1.0/24")/ICMP(),timeout=2)
Related