-
Notifications
You must be signed in to change notification settings - Fork 4
/
CVE-2021-21972.py
58 lines (53 loc) · 2.18 KB
/
CVE-2021-21972.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
import requests
import click
import urllib3
requests.packages.urllib3.disable_warnings()
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
URI = '/ui/vropspluginui/rest/services/uploadova'
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36",
"Content-Type": "application/x-www-form-urlencoded"
}
def title():
print('+------------------------------------------')
print('+ \033[34mgithub: https://github.com/yaunsky \033[0m')
print('+ \033[34mVersion: vCenter Server CVE-2021-21972 \033[0m')
print('+ \033[36m使用格式: python3 CVE-2021-21972.py --help \033[0m')
print('+------------------------------------------')
def scan(url):
target = str(url) + URI
try:
res = requests.get(target, headers=headers, timeout=10, verify=False)
if res.status_code == 405:
print("[+] URL:{}--------------存在CVE-2021-21972漏洞。".format(str(url)))
else:
print("[-] " + str(url) + " 不存在漏洞。")
except:
print("[-] " + str(url) + " Request ERROR.\n")
def batch(file):
f = open(file, 'r')
for target in f.readlines():
url = target.strip()
targetUrl = url + URI
print(targetUrl)
try:
res = requests.get(targetUrl, headers=headers, timeout=10, verify=False)
if res.status_code == 405:
print("[+] URL:{}--------------存在CVE-2021-21972漏洞。".format(url))
else:
print("[-] " + url + " 不存在漏洞。")
except:
print("[-] " + url + " Request ERROR.\n")
@click.command()
@click.option("--url", help='Target URL; Example:http://ip:port。')
@click.option("--file", help="Target File; Example:target.txt。")
def main(url,file):
title()
if url != None and file == None:
scan(url)
elif url == None and file != None:
batch(file)
else:
print("python3 CVE-2021-21972.py --help")
if __name__ == "__main__":
main()