Python3 小工具-UDP发现
from scapy.all import *
import optparse
import threading
import os
def scan(ip):
pkt=IP(dst=ip)/UDP(dport=65535)
res=sr1(pkt,timeout=0.1,verbose=0)
try:
if int(res[IP].proto)==1:
print(ip,' is online')
except:
pass
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='Filename')
(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/udphost
Python3 小工具-UDP发现的更多相关文章
- Python3 小工具-UDP扫描
from scapy.all import * import optparse import threading def scan(target,port): pkt=IP(dst=target)/U ...
- Python3 小工具-TCP发现
from scapy.all import * import optparse import threading import os def scan(ip): pkt=IP(dst=ip)/TCP( ...
- python3 小工具
扫描IP的端口是否开放:Porttest.py # -*- coding: utf-8 -*- import sys import os import socket #扫描 def scanport( ...
- ip地址查询python3小工具_V0.0.1
看到同事在一个一个IP地址的百度来确认导出表格中的ip地址所对应的现实世界的地址是否正确,决定给自己新开一个坑.做一个查询ip“地址”的python小工具,读取Excel表格,在表格中的后续列输出尽可 ...
- Python3 小工具-僵尸扫描
僵尸机的条件: 1.足够闲置,不与其他机器进行通讯 2.IPID必须是递增的,不然无法判断端口是否开放 本实验僵尸机选择的是Windows2003 from scapy.all import * im ...
- Python3 小工具-TCP半连接扫描
from scapy.all import * import optparse import threading def scan(ip,port): pkt=IP(dst=ip)/TCP(dport ...
- Python3 小工具-MAC泛洪
from scapy.all import * import optparse def attack(interface): pkt=Ether(src=RandMAC(),dst=RandMAC() ...
- Python3 小工具-ICMP扫描
from scapy.all import * import optparse import threading import os def scan(ipt): pkt=IP(dst=ipt)/IC ...
- Python3 小工具-ARP扫描
from scapy.all import * import optparse import threading import os def scan(ipt): pkt=Ether(dst='ff: ...
随机推荐
- 听说玩JAVA,必须过JDK这关?
JDK是什么?JRE是什么?JDK和JRE的区别? Java Runtime Environment (JRE) 包含: Java虚拟机.库函数.运行Java应用程序和Applet所必须文件 Java ...
- Swift_100个Swift必备Tips 王巍 PDF
Swift_100个Swift必备Tips 王巍 PDF GitHub下载地址
- MySql is marked as crashed and should be repaired问题
在一次电脑不知道为什么重启之后数据库某表出现了 is marked as crashed and should be repaired这个错误,百度了一下,很多都是去找什么工具然后输入命令之类的,因为 ...
- 技巧:Vimdiff 使用(改)
技巧:Vimdiff 使用(改) 各种 IDE 大行其道的同时,传统的命令行工具以其短小精悍,随手可得的特点仍有很大的生存空间,这篇短文介绍了一个文本比较和合并的小工具:vimdiff.希望能对在 U ...
- Cobbler实现自动化安装(下)--实现过程
实验环境 [root@cobbler ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@cobbler ~] ...
- 02JavaScript用法
前言: 介绍一下javascript的最基础语法规范和用法. HTML 中的脚本必须位于 <script> 与 </script> 标签之间. 脚本可被放置在 HTML 页面的 ...
- Postgresql 入门笔记
引言 最近整理了一些PostgreSQL的 常用命令,仅供参考 1. 入门命令 # 重启数据库 $ service postgresql-9.5 restart # 登陆: $ psql ...
- 微信小程序数据分析之自定义分析
在小程序后台,微信已经提供了强大的数据分析功能,包括实时统计.访问分析.来源分析和用户画像功能,可以说对一般的数据分析已经完全足够了,但有时应用需要做一些更加精准的数据分析,比如具体到某一个页面的分享 ...
- PHP在foreach中对$value赋值
foreach ($data as $key => $value) { $data[$key]['name'] = '测试在value中赋值';}
- 虚拟机的三种联网模式(桥接模式、NAT 模式、仅主机模式)
虚拟机的网络连接方式分为三种,分别是桥接模式.NAT 模式.和仅主机模式,三种连接模式存在着一定的差异,那么我们该如何选择适合自己的连接模式呢? 1.桥接模式:在此模式下,虚拟机相当于一台独立的电脑, ...