1+ #author:九世
2+ #time:2019/2/1
3+
4+ import requests
5+ import threading
6+ import os
7+ import time
8+
9+ dict = []
10+
11+ class Rkst :
12+ def __init__ (self ,headers ):
13+ self .headers = headers
14+
15+ def shenc (self ,file ):
16+ for k in file .readlines ():
17+ qc = "" .join (k .split ('\n ' ))
18+ yield qc
19+
20+ def one_domain (self ,ssl ,url ):
21+ for q in dict :
22+ urls = '{}' .format (ssl )+ q + '.' + url
23+ yield urls
24+
25+ def two_domain (self ,ssl ,url ):
26+ for v in dict :
27+ for v2 in dict :
28+ urls = '{}' .format (ssl )+ v + '.' + v2 + '.' + url
29+ yield urls
30+
31+ def san_domain (self ,ssl ,url ):
32+ for u in dict :
33+ for u1 in dict :
34+ for u2 in dict :
35+ urls = '{}' .format (ssl )+ u + '.' + u1 + '.' + u2 + '.' + url
36+ yield urls
37+
38+ def si_domain (self ,ssl ,url ):
39+ for s in dict :
40+ for s1 in dict :
41+ for s2 in dict :
42+ for s3 in dict :
43+ urls = '{}' .format (ssl )+ s + '.' + s1 + '.' + s2 + '.' + s3 + '.' + url
44+ yield urls
45+
46+ def wu_domain (self ,ssl ,url ):
47+ for b in dict :
48+ for b1 in dict :
49+ for b2 in dict :
50+ for b3 in dict :
51+ for b4 in dict :
52+ urls = '{}' .format (ssl )+ b + '.' + b1 + '.' + b2 + '.' + b3 + '.' + b4 + '.' + url
53+ yield urls
54+
55+ def bao (self ,url ):
56+ try :
57+ reqt = requests .get (url = url ,headers = self .headers ,timeout = 3 )
58+ if reqt :
59+ print ('[+] Found domain:{}' .format (url ))
60+ print (url ,file = open ('save.txt' ,'a' ))
61+ except :
62+ pass
63+
64+ lock .release () #Unlock the thread
65+
66+ if __name__ == '__main__' :
67+ headers = {'user-agent' :'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36' }
68+ if os .path .exists ('file/one.txt' ):
69+ print ('[+] Found dict.txt' )
70+ else :
71+ print ('[-] Not Found dict.txt...' )
72+ exit ()
73+
74+ dk = open ('file/one.txt' ,'r' )
75+
76+ user = input ('domain>:' )
77+ ssl = input ('http/https>:' )
78+ obj = Rkst (headers = headers )
79+ if ssl == 'http' :
80+ ht = 'http://'
81+ elif ssl == 'https' :
82+ ht = 'https://'
83+
84+ print ('[!] Test the first level domain name' )
85+ for o in obj .shenc (dk ):
86+ dict .append (o )
87+
88+
89+ lock = threading .BoundedSemaphore (100 ) #Set the thread to 100
90+ print ('[!] Write the generated first-level domain name to the list' )
91+ for y in obj .one_domain (ht ,user ):
92+ lock .acquire () #Lock the thread
93+ t = threading .Thread (target = obj .bao , args = (y ,))
94+ t .start ()
95+
96+ print ('[!] Write the generated second-level domain name to the list' )
97+ for y2 in obj .two_domain (ht ,user ):
98+ lock .acquire ()
99+ t = threading .Thread (target = obj .bao , args = (y2 ,))
100+ t .start ()
101+
102+ print ('[!] Write the generated third-level domain name to the list' )
103+ for y3 in obj .san_domain (ht ,user ):
104+ lock .acquire ()
105+ t = threading .Thread (target = obj .bao , args = (y3 ,))
106+ t .start ()
107+
108+ print ('[!] Write the generated four-level domain name to the list' )
109+ for y4 in obj .si_domain (ht ,user ):
110+ lock .acquire ()
111+ t = threading .Thread (target = obj .bao , args = (y4 ,))
112+ t .start ()
113+
114+ print ('[!] Write the generated five-level domain name to the list' )
115+ for y5 in obj .wu_domain (ht ,user ):
116+ lock .acquire ()
117+ t = threading .Thread (target = obj .bao , args = (y5 ,))
118+ t .start ()
0 commit comments