forked from themycode/python-hacker-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo_s.py
More file actions
63 lines (52 loc) · 1.61 KB
/
demo_s.py
File metadata and controls
63 lines (52 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import gevent
from gevent import monkey;monkey.patch_all()
import socket
from multiprocessing import Process
port_lit=[80,443,8080]
texts=[]
class domain_bao:
def __init__(self,headers):
self.headers=headers
def demo(self,doamin):
g=socket.gethostbyname_ex(doamin)
if domain_ex in g[0]:
s=socket.socket()
try:
for k in port_lit:
s.connect((g[0],k))
zk='域名:{}'.format(g[0])
if zk in texts:continue
texts.append(zk)
except:
pass
else:
pass
self.echo()
def echo(self):
if len(texts)>0:
for t in texts:
print(t)
def xc(self,ld):
go=[]
for l in ld:
go.append(gevent.spawn(self.demo,l))
gevent.joinall(go)
def djc(self):
global domain_ex
domain_ex='huazhu.com'
doamin_list=[]
calc=0
with open('/root/Jb/domain_query/file/phpinfo_me_dict.txt','r') as r:
for g in r.readlines():
qc="".join(g.split('\n'))+'.'+domain_ex
doamin_list.append(qc)
calc+=1
if calc==500:
p=Process(target=self.xc,args=(doamin_list,))
p.start()
doamin_list.clear()
calc=0
if __name__ == '__main__':
headers={'user-agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36'}
obj=domain_bao(headers=headers)
obj.djc()