资源简介
自己用PYTHON写的多线程扫描子域名 没啥优化 速度还看得过去 有啥类似的好工具也可以给我推荐下 我是找不到才自己写的
PYTHON27写的 其他版本不能保证完全没有问题

代码片段和文件信息
#!/usr/bin/python
‘Threads To Get SubDomain‘
import sys
import threading
import getopt
from socket import gethostbyname
from time import ctimesleepclock
from Queue import Queue
threads=[]
#ger args
args=sys.argv[1:]
if ‘-d‘ in args:
mainDomain=args[1+args.index(‘-d‘)].strip()
else:
mainDomain=raw_input(‘Input The Domain:\r\n‘)
if not mainDomain.strip():
mainDomain=‘qinqinyo.com‘
if ‘-t‘ in args:
threadNum=int(args[1+args.index(‘-t‘)])
else:
threadNum=20
#define subdomain queue
q=Queue()
wrongIp=[‘Error‘]
rightDomain={}
toStop=[]
#subdomain list
subList=file(‘domain.txt‘‘r‘)
#totalnowrightwrong count
totalnowrightwrong=0000
def trySub(i):
global totalnowrightwrongthreadNumrightDomainwrongIptoStop
while not q.empty() and toStop[i]:
sub=q.get()
try:
temp=gethostbyname(sub)
except Exceptione:
temp=‘Error‘
finally:
now+=1
if not temp in wrongIp:
rightDomain[sub]=temp
right+=1
else:
wrong+=1
if toStop[i]:
tempStr=‘%s / %s Completed Right %s Wrong %s Used %.2f\r\n‘ % (nowtotalrightwrongclock())
print tempStr
for each in subList:
q.put(str(each).rstrip()+‘.‘+mainDomain)
total=q.qsize()
print ‘Domain‘mainDomain‘Threads‘threadNum‘Load Complete : ‘total
for i in range(10):
try:
temp=gethostbyname(‘amwswceud.‘+str(i)+‘.‘+mainDomain)
except Exceptione:
continue
if not temp in wrongIp:
wrongIp.append(temp)
print temp
clock()
print ‘-------------‘
for i in range(threadNum):
t=threading.Thread(target=trySubargs=[i])
toStop.append(1)
threads.append(t)
for thread in threads:
thread.start()
try:
for thread in threads:
while thread.isAlive():
continue
except KeyboardInterrupt e:
for i in range(threadNum):
toStop[i]=0
print ‘->‘
for tempDomaintempIp in rightDomain.items():
print tempDomain.ljust(20)tempIp.rjust(15)
print ‘->‘
sys.exit(1)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2543 2014-12-10 15:25 domain.py
文件 103234 2014-12-05 11:44 domain.txt
----------- --------- ---------- ----- ----
105777 2
相关资源
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 一个多线程智能爬虫,爬取网站小说
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
- Python Machine Learning Case Studies
评论
共有 条评论