I'm learning about ARP spoofing and trying to understand how to send an ARP response from one host to another with Python 3 raw sockets.
However, the host's ARP cache to which I send the response does not resolve the MAC address of the other host. Please do not tell me to do that
I'm sending the answer from 192.168.1.6 to 192.168.1.4
This is my code:
import base import struct import binascii raw = socket.socket (socket.PF_PACKET, socket.SOCK_RAW, socket.ntohs (0x0806)) raw.bind (("wlp3s0", socket.htons (0x0806))) mac_local = & # 39; & # 39; ip_local = "192.168.1.6" mac_dest = & # 39; & # 39; ip_dest = "192.168.1.4" type_hardware = 1 type_protocol = 0x0800 len_hardware = 6 len_protocol = 4 op = 2 src_ip = socket.inet_aton (ip_local) dest_ip = socket.inet_aton (ip_dest) mac_dest_byte_order = binascii.unhexlify (mac_dest.replace (":", "")) mac_src_byte_order = binascii.unhexlify (mac_local.replace (":", "")) # Ethernet frame Protocol = 0x0806 ethernet_frame = struct.pack ("! 6s6sH", mac_dest_byte_order, mac_src_byte_order, protocol) arp_header = struct.pack ("! HHBBH6s4s6s4s"), type_hardware, type_protocol, len_hardware, len_protocol, operating room mac_src_byte_order, src_ip, mac_dest_byte_order, dest_ip) pkt = ethernet_frame + arp_header while true: raw.send (pt)