#!/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数:"+str(i)) fp.close()
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。