Python3 小工具-TCP发现
from scapy.all import *
import optparse
import threading
import os
def scan(ip):
pkt=IP(dst=ip)/TCP(flags='A')
res=sr1(pkt,timeout=0.1,verbose=0)
if res:
print(ip,' 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='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/tcphost
Python3 小工具-TCP发现的更多相关文章
- Python3 小工具-TCP半连接扫描
from scapy.all import * import optparse import threading def scan(ip,port): pkt=IP(dst=ip)/TCP(dport ...
- Python3 小工具-UDP发现
from scapy.all import * import optparse import threading import os def scan(ip): pkt=IP(dst=ip)/UDP( ...
- 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表格,在表格中的后续列输出尽可 ...
- Python写安全小工具-TCP全连接端口扫描器
通过端口扫描我们可以知道目标主机都开放了哪些服务,下面通过TCP connect来实现一个TCP全连接端口扫描器. 一个简单的端口扫描器 #!/usr/bin/python3 # -*- coding ...
- Python3 小工具-僵尸扫描
僵尸机的条件: 1.足够闲置,不与其他机器进行通讯 2.IPID必须是递增的,不然无法判断端口是否开放 本实验僵尸机选择的是Windows2003 from scapy.all import * im ...
- Python3 小工具-UDP扫描
from scapy.all import * import optparse import threading def scan(target,port): pkt=IP(dst=target)/U ...
- 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 ...
随机推荐
- injection for Xcode10使用方法
对于一个使用Xcode的使用者来说,麻烦的地方在于使用代码布置界面时候的调试,5s改一下代码,用10s查看修改效果,如果电脑配置稍低,时间更长,这是病,得治,哈哈.下面就来说一下injection的使 ...
- SQL 存储过程生成
use workflow; GO /****** 对象: StoredProcedure [dbo].[pro_GenerateProGet] 脚本日期: 08/03/2012 11:26:43 ** ...
- c/c++面试指导---c语法总结
任何一门学科或者专业在学习的过程中都要把握总结框架,大家在面试c/c++职位过程中要应对各种企业的面试,回答企业面试官的各种技术问题.如何应对各种各样的关于c/c++的企业面试题目,从各种繁杂的题目中 ...
- xtrabackup全量备份+binlog基于时间点恢复
1.通过xtrabackup的备份恢复数据库. 2.找到start-position和binlog名称 cat xtrabackup_info 3.导出mysqlbinlog为sql文件,并确定恢复的 ...
- CentOS7.5二进制安装MySQL-5.6.40
安装依赖 yum install -y gcc gcc-c++ automake autoconf yum -y install cmake bison-devel ncurses-devel lib ...
- Django学习笔记1
重点在注释# 1.views.py from django.shortcuts import render from django.http import * #from django.templat ...
- ASP.NET Core学习网站推荐
跟大家推荐一个不错的学习.NET Core 的网站,这个网站的视频是付费的,但是录视频的都是.NET Core的大佬们,个人觉得很不错推荐出来 video.jessetalk.cn
- PHP Mysql字符集utf8mb4支持Emoji表情
项目开发中经常会遇到用户在评论或者发表文章的时候会打一些表情在里面,如果我们在开发中不去做一些处理的话,表情会出不来的,甚至是报错,下面简单介绍处理方式.原文地址:小时刻个人博客:http://sma ...
- DMVPN的实验模拟与分析
此篇博客正在介绍的是下图中的DMVPN: 为什么会出现DMVPN这个技术呢? 在这篇博客中https://www.cnblogs.com/huwentao/p/9355240.html介绍过Dynam ...
- BINARYSEARCH有り無しのパフォーマンスの違い
BINARY SEARCHを使用したパフォーマンス検証を行ってみた.この例では.BKPFが約1万件.BSEGが約3万件になるよう調整している.また.SQLの実行に係る時間は無視する事にする. サンプル ...