您好,登錄后才能下訂單哦!
#!/usr/bin/env python3 #-*-coding:utf-8-*- # @Author : 杜文濤 # @Time : 2018/5/22 9:24 # @File : scapy_test.py #encoding=utf-8 from scapy.all import * def worker(): ip_list=[] for ipFix in range(1,20): ip="192.168.0."+str(ipFix) arpPkt = Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=ip, hwdst="ff:ff:ff:ff:ff:ff") res = srp1(arpPkt, timeout=1, verbose=False) if res: print ("IP: " + res.psrc + " MAC: " + res.hwsrc) ip_list.append(res.psrc) return ip_list if __name__=="__main__": fp = open('ip.txt','w') ip_list = worker() i = 0 for ip in ip_list: fp.write(ip+'\n') i += 1 print("掃描到的IP數(shù):"+str(i)) fp.close()
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。