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. oracle sqldrl命令与以及ctl文件

    具体操作如下: 第一步:先编辑好数据控制文件 xx.ctl,如test.ctl options(skip=1)   --跳过第一行(看实际情况) load data infile 'C:\Users\ ...

  2. 时间、时间戳相关小结 - iOS

    项目中难免会与时间打交道,故此次围绕时间展开做了一些日常使用的小结;如下 code 中也是围绕一些日常开发中较为常用的点展开小的方法封装. 具体方法的使用如下: // 2019-02-21 17:30 ...

  3. hql返回数值

    public int getCountUser() throws ParseException { Session hSession = sessionFactory.getCurrentSessio ...

  4. 原型 - 实现自己的jQuery

    每个第一次使用jq的开发者都感到惊叹,jq的$太神奇了,究竟是怎么做到的使用$控制dom 赞叹前人之余,探究其本源才是前端开发者应该做的事,社区常常说,不要重复造轮子, 可是啊,连轮子都造不出来,又怎 ...

  5. ethereum(以太坊)(十四)--Delete

    pragma solidity ^0.4.10; contract Delete{ /* delete可用于任何变量(除mapping),将其设置成默认值 bytes/string:删除所有元素,其长 ...

  6. CentOS 7.x下升级Python版本到3.x系列(新老版本共存)

    由于python官方已宣布2.x系列即将停止支持,为了向前看,我们升级系统的python版本为3.x系列服务器系统为当前最新的CentOS 7.4 1.安装前查看当前系统下的python版本号 # p ...

  7. 微信小程序快速转成百度小程序的方法

    1.安装Node.js(>8.5.0)https://nodejs.org/ npm升级到最新版本的方法:npm install -g npm自动更新到最新版本 2.配置cnpm:在命令行中输入 ...

  8. 中国大学MOOC-C程序设计(浙大翁恺)—— 素数和

    题目内容: 我们认为2是第一个素数,3是第二个素数,5是第三个素数,依次类推. 现在,给定两个整数n和m,0<n<=m<=200,你的程序要计算第n个素数到第m个素数之间所有的素数的 ...

  9. C# 获取UTC 转换时间戳为C#时间

    获取UTC /// <summary> /// 获取时间戳 /// </summary> /// <returns>UTC</returns> publ ...

  10. (转载)PHP环境搭建-记录

    PHP环境搭建-记录   转于 http://jingyan.baidu.com/article/fcb5aff797ec41edaa4a71c4.html php5.5 做了大量的更新,在与apac ...