from scapy.all import *
import optparse
import threading
import os

def scan(ipt):
    pkt=Ether(dst='ff:ff:ff:ff:ff:ff')/ARP(pdst=ipt)
    res=srp1(pkt,timeout=0.1,verbose=0)
    if res:
        print(ipt,' is online')

def main():
    parser=optparse.OptionParser('%prog'+"-t <target> -f <filename>")
    parser.add_option('-t',dest='target',type='string',help='Target')
    parser.add_option('-f',dest='fil',type='string',help='File')
    (options,args)=parser.parse_args()
    target=options.target
    fil=options.fil

    if(target==None) and (fil==None):
        print('Please input target(-t) or file(-f)')
        exit(0)
    if target:
        iplist=target.split('.')
        ip=iplist[0]+'.'+iplist[1]+'.'+iplist[2]+'.'
        for t in range(1,255):
            ipt=ip+str(t)
            t=threading.Thread(target=scan,args=(ipt,))
            t.start()
    if fil:
        if os.path.exists(fil):
            with open(fil) as f:
                for i in f.readlines():
                    ipt=i.strip('\n')
                    t=threading.Thread(target=scan,args=(ipt,))
                    t.start()
        else:
            print('File is not exists!')
            exit(0)

if __name__=='__main__':
    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. MySQL高可用之MGR安装测试

    Preface     We've learned the machenism of MGR yesterday,Let's configurate an environment and have s ...

  2. pastedeploy

    3.1作用 不修改WSGI应用程序的情况下通过配置文件配置WSGI服务. filter:过滤器,滤网. pipline:管道 app:application 应用,在这个语境下我举个例子吧,lavab ...

  3. Docker 相关命令汇总

    操作容器的命令 镜像中的容器启动之后可以在 docker 中操作和查看容器的信息 l   docker ps 查看运行的容器,如果想查看全部加上参数-a 即可 l   docker create 完整 ...

  4. JSP/Servlet开发——第八章 JSTL和EL

    1. EL表达式: ●需要EL表达式的原因: ◆在JSP中使用Java脚本的局限: 1).在JSP页面中嵌入大量的Java代码: 2).访问结构比较复杂的数据时代码烦琐,且经常需要强制类型转换: eg ...

  5. PHP基础3--文件加载-错误处理

    主要: 1-文件加载 2-错误处理 文件加载 文件加载语句 1) 4个文件加载语句:include,  require,   include_once,    require_once 2) 使用形式 ...

  6. CAT 安装运行配置教程

    CAT安装教程 首先安装mysql数据库,具体步骤参阅<mysql免安装教程>--http://www.cnblogs.com/halberts/p/8723938.html 下载CAT代 ...

  7. LCD触屏驱动

    tiny4412多点触摸屏驱动程序(基于I2C协议): #include <linux/kernel.h> #include <linux/module.h> #include ...

  8. python应用:爬虫框架Scrapy系统学习第三篇——初识scrapy

    scrapy的最通用的爬虫流程:UR2IM U:URL R2:Request 以及 Response I:Item M:More URL 在scrapy shell中打开服务器一个网页 cmd中执行: ...

  9. Stream的顺序流与并行流

    /** * @auther hhh * @date 2019/1/2 22:52 * @description */ public class StreamAPI2 { /** * 流的特性:支持并行 ...

  10. Canvas在移动端设备上模糊出现锯齿边

    在绘制的过程中画布内容的实际大小是根据 canvas 的 width 与 height 属性设置的,而 style 或者CSS设置的width 与 height 只是简单的对画布进行缩放. canva ...