from scapy.all import *
import optparse
import threading

def scan(target,port):
    pkt=IP(dst=target)/UDP(dport=int(port))
    res=sr1(pkt,timeout=0.1,verbose=0)
    if res==None:
        print(port,' is online')

def main():
    parser=optparse.OptionParser("%prog"+"-t <target> -p <port>")
    parser.add_option('-t',dest='target',type='string',help='Target')
    parser.add_option('-p',dest='port',type='string',help='Port(split with \',\')')
    (options,args)=parser.parse_args()
    target=options.target
    ports=str(options.port).split(',')
    if(target==None) or (ports[0]==None):
        print('Please input target(-t) and port(-p)!')
        exit(0)
    for port in ports:
        t=threading.Thread(target=scan,args=(target,port))
        t.start()

if __name__=='__main__':
    main()

使用说明

程序开始

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

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

  1. Python3 小工具-UDP发现

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

  2. Python3 小工具-僵尸扫描

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

  3. Python3 小工具-ICMP扫描

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

  4. Python3 小工具-ARP扫描

    from scapy.all import * import optparse import threading import os def scan(ipt): pkt=Ether(dst='ff: ...

  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 小工具-TCP发现

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

  9. Python3 小工具-MAC泛洪

    from scapy.all import * import optparse def attack(interface): pkt=Ether(src=RandMAC(),dst=RandMAC() ...

随机推荐

  1. oracle database 9i/10g/11g 编程艺术 源代码下载

    背景 在找这本书的源码,搜到提供的都是需要C币下载的.比较固执(其实是穷). 在这本书的前言中提到源代码可以在 www.appress.com 上下载. 下面是该书在该网站上的链接: https:// ...

  2. 解决最新版 mac os sierra usb网卡不能使用的问题

    解决最新版 mac os sierra usb网卡不能使用的问题 解决最新版 mac os sierra usb网卡不能使用 无法使用未签名第三驱动的问题 我的情况是 mac os sierra 使用 ...

  3. mybatis传单个参数,和<if>标签同时使用的问题

    // Mapper.java EmerEvent selectByAlarmId(Integer alarmId); // Mapper.xml <select id="selectB ...

  4. Elasticsearch 索引操作

    一.创建 语法: PUT /索引库名称 { "settings": { "number_of_shards": 分片数量, "number_of_re ...

  5. python 基于Anaconda import numpy 报错 Importing the multiarray numpy extension module failed.

    在windows中安装了 Anaconda 运行时报错 原因是系统环境变量起初并没有引入 E:\Tools\Anaconda\Library\bin 解决办法: 在系统环境变量中加入    E:\To ...

  6. 【tp5.1】通过PHPExcel实现导入excel表格

    1.上github下载PHPExcel,链接:https://github.com/PHPOffice/PHPExcel 2.下载解压后,将Classes改名为PHPExcel如图 3.将文件夹复制到 ...

  7. 发现新大陆QuickBurro中间件 http://www.quickburro.org

    可以做手机.网页,三层C/S?这么神?

  8. GeekOS: 一、构建基于Ubuntu9.04的实验环境

    参考:http://www.cnblogs.com/wuchang/archive/2009/05/05/1450311.html 补充:在最后步骤中,执行bochs即可弹出运行窗口

  9. [原创]python高可用程序设计方法

    有时候程序上的bug会导致程序引发诸如段错误的情况而导致程序异常退出,这时用crond服务来检测,就会有一段时间程序处于不可用的情况,为了增强程序的可用性,我们可以让子进程处理业务,而让主进程检测子进 ...

  10. JavaScript’s “this”: how it works, where it can trip you up

    JavaScript’s “this”: how it works, where it can trip you up http://speakingjs.com/es5/ch23.html#_ind ...