-
Notifications
You must be signed in to change notification settings - Fork 1
/
checker.py
28 lines (23 loc) · 969 Bytes
/
checker.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
import requests,sys
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# Ensure that a command-line argument is provided
if len(sys.argv) < 2:
print(f"Usage: python3 {sys.argv[0]} <path_to_hosts_file>")
sys.exit(1)
hostsfile = sys.argv[1]
secure = "Access to the Web site is blocked by your administrator"
try:
with open(hostsfile, "r") as f:
# Read the lines from the file and create a list
hosts_list = f.read().splitlines()
for host in hosts_list:
r=requests.get(f"{host}/api/v1/configuration/users/user-roles/user-role/rest-userrole1/web/web-bookmarks/bookmark", verify=False)
if secure not in r.text:
print(f"{host} is Vulnerable!!")
else:
print(f"{host} is Patched")
except FileNotFoundError:
print(f"Error: File '{hostsfile}' not found.")
except Exception as e:
print(f"Error: An unexpected error occurred - {e}")