Reputation: 23
I am learning "Python Black Hat". I will not respond when I use scapy to get the IP address of ip. I have not received any reply from the sent packet. I found a simple example from the Internet and the effect is the same. Why is that?
from scapy.all import srp,Ether,ARP,conf
ipscan='127.0.0.1'
try:
ans,unans=
srp(Ether(dst="FF:FF:FF:FF:FF:FF")/ARP(pdst=ipscan),timeout=2,verbose=False)
except Exception as e:
print(str(e))
else:
for snd,rcv in ans:
list_mac=rcv.sprintf("%Ether.src% - %ARP.psrc%")
print(list_mac)
I learned ARP spoofing in the book, experimented with my win7 virtual machine, but failed to get the MAC address.
Upvotes: 0
Views: 845
Reputation: 189
Since every network interface only answer for address that bound to them and You're sending your packet to yourself (127.0.0.1), nobody answer your request. change the ipscan then it works fine
Upvotes: 1