简体   繁体   中英

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

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%") )

srp1只返回第一个答案

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM