-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathcve-2020-2551_poc.py
86 lines (78 loc) · 2.38 KB
/
cve-2020-2551_poc.py
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/python3
# -*- coding:utf-8 -*-
import socket,argparse,sys,requests
from urllib.parse import urlparse
from multiprocessing.dummy import Pool as ThreadPool
print ('''
+--------------------------------------------------- -----+
+ USE: python cve-2020-2551_poc.py <url:port> +
+ VER: 10.3.6.0.0 +
+ 12.1.3.0.0 +
+ 12.2.1.3.0 +
+ 12.2.1.4.0 +
+ EXP: python3 cve-2020-2551_poc.py -u http://1.1.1.1:7001 +
+-----------------------------------------------------------+
''')
def doThreads(fnCbk,lists,nThreads=32):
pool = ThreadPool(nThreads)
pool.map(fnCbk,lists)
pool.close()
pool.join()
def doSendOne(ip,port,data):
sock=None
res=None
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(7)
server_addr = (ip, int(port))
sock.connect(server_addr)
sock.send(data)
res = sock.recv(20)
if b'GIOP' in res:
return True
except Exception as e:
pass
finally:
if sock!=None:
sock.close()
return False
g_bPipe=False
def doOne(url):
global g_bPipe
oH=urlparse(url)
a=oH.netloc.split(':')
port=80
if 2 == len(a):
port=a[1]
elif 'https' in oH.scheme:
port=443
if doSendOne(a[0],port,bytes.fromhex('47494f50010200030000001700000002000000000000000b4e616d6553657276696365')):
print('[+] found CVE-2020-2551 ', oH.netloc)
elif g_bPipe == False:
print('[-] not found CVE-2020-2551 ', oH.netloc)
def doPipe():
global g_bPipe
g_bPipe=True
buff = ''
a=[]
while True:
buff = sys.stdin.readline()
if not buff:
break
if buff.endswith('\n'):
szTmpCmd = buff[:-1]
szTmpCmd=szTmpCmd.rstrip()
buff = ''
if not szTmpCmd:
break
a.append(szTmpCmd)
doThreads(doOne,a)
if __name__=='__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-u","--url",help="http://xxx.xxx.xxx:7001/")
parser.add_argument("-e","--pipeCheck",help="pipe check is Ok,thread 32",action="store_true")
args = parser.parse_args()
if args.url:
doOne(args.url)
if args.pipeCheck:
doPipe()