简体   繁体   中英

Why binding pdst with the target ip address and binding a broadcast mac address instead of the target mac address

In 'The Black Hat Python' book page number 53 the restore_target. Why We specify the ip address of the gateway and not specifying its mac address ? I mean if we're going to broadcast our ARP packet then why give pdst value of a specific ip address instead of a broadcast ip address like the hwdst ? ?

send(ARP(op=2, psrc=gateway_ip, pdst=target_ip, hwdst="ff:ff:ff:ff:ff:ff",hwsrc=gateway_mac),count=5)

What you're sending here is called a Gratuitous ARP . It's a special kind of packets, defined by the fact that the destination Mac is ff:ff:ff:ff:ff:ff .

Have a look at: https://www.practicalnetworking.net/series/arp/gratuitous-arp/

The difference is that it is an answer packet, even if there was no request packet. It's "gratuitous". In your case, you are sending a packet mapping psrc to hwsrc , sent to everyone: the router is advertising his MAC to everyone.

In this case, pdst has little meaning, but it should be set by convention to the same address than psrc . I don't know why it was different in your example.

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