network_conflict_creator.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:raw-packet 作者: Vladimir-Ivanov-Git 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号