1. from scapy.all import *
  2. import optparse
  3. import threading
  4. import os
  5. def scan(ipt):
  6. pkt=Ether(dst='ff:ff:ff:ff:ff:ff')/ARP(pdst=ipt)
  7. res=srp1(pkt,timeout=0.1,verbose=0)
  8. if res:
  9. print(ipt,' is online')
  10. def main():
  11. parser=optparse.OptionParser('%prog'+"-t <target> -f <filename>")
  12. parser.add_option('-t',dest='target',type='string',help='Target')
  13. parser.add_option('-f',dest='fil',type='string',help='File')
  14. (options,args)=parser.parse_args()
  15. target=options.target
  16. fil=options.fil
  17. if(target==None) and (fil==None):
  18. print('Please input target(-t) or file(-f)')
  19. exit(0)
  20. if target:
  21. iplist=target.split('.')
  22. ip=iplist[0]+'.'+iplist[1]+'.'+iplist[2]+'.'
  23. for t in range(1,255):
  24. ipt=ip+str(t)
  25. t=threading.Thread(target=scan,args=(ipt,))
  26. t.start()
  27. if fil:
  28. if os.path.exists(fil):
  29. with open(fil) as f:
  30. for i in f.readlines():
  31. ipt=i.strip('\n')
  32. t=threading.Thread(target=scan,args=(ipt,))
  33. t.start()
  34. else:
  35. print('File is not exists!')
  36. exit(0)
  37. if __name__=='__main__':
  38. main()

使用说明

开始程序

github:https://github.com/zmqq/pytools/tree/master/arpscan

Python3 小工具-ARP扫描的更多相关文章

  1. Python3 小工具-ARP欺骗

    在kali中使用 from scapy.all import * import optparse import os def send(pkt,interface): for p in pkt: se ...

  2. Python3 小工具-UDP扫描

    from scapy.all import * import optparse import threading def scan(target,port): pkt=IP(dst=target)/U ...

  3. Python3 小工具-僵尸扫描

    僵尸机的条件: 1.足够闲置,不与其他机器进行通讯 2.IPID必须是递增的,不然无法判断端口是否开放 本实验僵尸机选择的是Windows2003 from scapy.all import * im ...

  4. Python3 小工具-ICMP扫描

    from scapy.all import * import optparse import threading import os def scan(ipt): pkt=IP(dst=ipt)/IC ...

  5. python3 小工具

    扫描IP的端口是否开放:Porttest.py # -*- coding: utf-8 -*- import sys import os import socket #扫描 def scanport( ...

  6. ip地址查询python3小工具_V0.0.1

    看到同事在一个一个IP地址的百度来确认导出表格中的ip地址所对应的现实世界的地址是否正确,决定给自己新开一个坑.做一个查询ip“地址”的python小工具,读取Excel表格,在表格中的后续列输出尽可 ...

  7. Python3 小工具-TCP半连接扫描

    from scapy.all import * import optparse import threading def scan(ip,port): pkt=IP(dst=ip)/TCP(dport ...

  8. Python3 小工具-UDP发现

    from scapy.all import * import optparse import threading import os def scan(ip): pkt=IP(dst=ip)/UDP( ...

  9. Python3 小工具-TCP发现

    from scapy.all import * import optparse import threading import os def scan(ip): pkt=IP(dst=ip)/TCP( ...

随机推荐

  1. C++ ACM基础

    一.C++结构体 #include <iostream> using namespace std; struct Point{ int x; int y; Point(int x=0,in ...

  2. SpringBoot使用maven插件打包時報:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException的處理方案

    SpringBoot使用maven插件打包時報:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExec ...

  3. mysql碰到的问题总结

    1.问题描述: 连接数据库出现大约10s延迟后才能连接,排除网络问题 解决方案: 通过抓包工具tcpdump抓包分析mysql在连接开始有近10s的空白请求,问题原因就在这 ,不知道在执行什么请求,后 ...

  4. 32位ubuntu16.04桌面版系统安装

    1.下载并安装UltraISO软件安装之后插入U盘 2.然后打开软件点击文件打开找到下载的Ubuntu的ISO文件双击打开完成ISO文件的加载 3.点击启动选项(记得点开加载后的镜像,使之展开如图) ...

  5. 解决微信小程序安卓手机访问不到图片,无法显示图片

    关于微信小程序不显示图片 通病可能有以下几个可能性: 非本地图片:确定图片资源存在,copy 图片url再浏览器打开,确定图片资源存在且能正常访问 本地图片:确定相对路径或者绝对路径正确 微信小程序图 ...

  6. 「PHP」简单工厂模式

    引言   所属:创建型模式,常用设计模式之一 工厂模式分为:简单工厂模式.工厂方法模式.静态工厂模式.抽象工厂模式. 下面为简单工厂模式.   参考资料: <大话设计模式>程杰   模式概 ...

  7. MySQL数据库 : 函数和存储过程

    CONCAT 可以把多个字符串连在一起,如把 doc_id 和 title这两个字段的查询结果组合成一个字符串:SELECT CONCAT(doc_id,title) FROM simhash; CO ...

  8. PHP的高效率写法

    1.尽量静态化: 如果一个方法能被静态,那就声明它为静态的,速度可提高1/4,甚至我测试的时候,这个提高了近三倍. 当然了,这个测试方法需要在十万级以上次执行,效果才明显. 其实静态方法和非静态方法的 ...

  9. ajax重定向登录页

    /** * ajax默认设置 * 包括默认提交方式为POST, * 判断后台是否是重定向 */ $.ajaxSetup( { //设置ajax请求结束后的执行动作 complete : functio ...

  10. C语言思维导图总结