forked from biggerwing/CVE-2019-0708-poc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcve-2019-0708.py
52 lines (38 loc) · 1.34 KB
/
cve-2019-0708.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
# _*_ coding: utf-8 _*_
"""
auth: bigger.wing, Fulong Sun
version: v1.0-r1
function: cve-2019-0708漏洞检测
usage:
note: 借助于poc做检测,3389_hosts为IP地址清单,3389_cidrs为IP地址段清单,0708detector.exe为poc
"""
from ipaddress import ip_network
import os
import subprocess
from multiprocessing.dummy import Pool as ThreadPool
current_abs_path = os.path.abspath(__file__)
current_abs_path_dir = os.path.dirname(current_abs_path)
poc = os.path.abspath(current_abs_path_dir) + '/0708detector.exe'
def cve_2019_0708(ip, port='3389'):
command = poc + ' -t ' + ip + ' -p ' + port
result = subprocess.getoutput(command)
# print(command, '\n', result)
if 'WARNING: SERVER IS VULNERABLE' in result:
result = '%s 存在CVE-2019-0708漏洞' % ip
else:
result = '%s 不存在CVE-2019-0708漏洞' % ip
print(result)
if __name__ == '__main__':
rdp_hosts = []
with open('3389_hosts', 'r') as f:
data = f.readlines()
for x in data:
ip = x.strip()
rdp_hosts.append(ip)
with open('3389_cidrs', 'r') as f:
data = f.readlines()
for x in data:
for ip in ip_network(x.strip()):
rdp_hosts.append(str(ip))
pool = ThreadPool(10)
pool.map(cve_2019_0708, rdp_hosts)