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. DQL-排序查询

    三:排序查询 语法: select  列名 from    表名 where  筛选条件 order by  需要排序的列名   asc/desc 特点:不写升序还是降序,默认升序 排序列表 可以是 ...

  2. 利用DBMS_REDEFINITION包将非分区表转化成分区表

    将普通表格转化分区表的方法大致有四种: A. 通过 Export/import 方法B. 通过 Insert with a subquery 方法C. 通过 Partition Exchange 方法 ...

  3. Qt5应用程序封包

    系统环境:windows10+vs2017+qt5.12 目的:生成.exe可执行文件. 步骤: 1.选择release模式,生成解决方案. 2.打开命令行,cd到生成的可执行文件.exe目录下 3. ...

  4. Java中BigDecimal的一个除法异常

    java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal res ...

  5. C# 后台Http访问 raw from 键值对

    using RestSharp;using System;using System.Collections;using System.Collections.Generic;using System. ...

  6. QueryableHelper

    using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; us ...

  7. nginx知识总结

    nginx知识总结 一.功能 负载均衡 反向代理 静态资源服务器 二.来源 nginx 俄罗斯第二网站开源项目 tengine 淘宝团队基于nginx开发的 区别:nginx安装之后还得装第三方软件包 ...

  8. day 26 网络知识 01

    一.    c/s 架构: 客户端(client)/服务端(server)架构       服务端: 提供服务的      客户端: 享受服务的     B/S 架构:浏览器(browser)/服务端 ...

  9. 树莓派3B+学习笔记:3、启用root账户

    1.打开终端,输入 sudo passwd root 输入两次密码后设置root账户密码: 2.输入 sudo passwd --unlock root 解锁root账户: 3.点击主菜单的“Shut ...

  10. 使用GlobalKey启动APP

    按键输入有三种:system key  音量键 global key 按下启动某个APP user key  ABCD... 给安卓应用程序定义一个广播接收者,写一个BroadcastReceiver ...