-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcheckdebuglog.py
More file actions
34 lines (28 loc) · 1.33 KB
/
Copy pathcheckdebuglog.py
File metadata and controls
34 lines (28 loc) · 1.33 KB
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
import requests
from concurrent.futures import ThreadPoolExecutor, as_completed
def check_debug_log(url):
try:
clean_url = url.strip()
response = requests.get(f"{clean_url.rstrip('/')}/wp-content/debug.log", timeout=10)
return clean_url, response.status_code == 200
except requests.RequestException as e:
print(f"Error checking {clean_url}: {e}")
return clean_url, False
def process_urls_from_file(input_file_path, output_file_path):
with open(input_file_path, 'r') as file:
urls = file.readlines()
with ThreadPoolExecutor(max_workers=10) as executor:
future_to_url = {executor.submit(check_debug_log, url): url for url in urls}
with open(output_file_path, 'w') as output_file:
for future in as_completed(future_to_url):
url, success = future.result()
if success:
output_file.write(f"{url.rstrip('/')}/wp-content/debug.log\n")
print(f"Debug log found at: {url.rstrip('/')}/wp-content/debug.log")
else:
print(f"No debug log found at: {url.rstrip('/')}/wp-content/debug.log")
if __name__ == "__main__":
#Change this
input_file_path = 'urls.txt'
output_file_path = 'output.txt'
process_urls_from_file(input_file_path, output_file_path)