lilbool/vuln-code-analysis
0
1import requests
2import os
3import time
4
5def download_exploit(exploit_id, save_dir):
6 url = f"https://www.exploit-db.com/raw/{exploit_id}"
7 headers = {
8 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
9 }
10 try:
11 response = requests.get(url, headers=headers)
12 if response.status_code == 200:
13 with open(os.path.join(save_dir, f"exploit_{exploit_id}.txt"), 'w', encoding='utf-8') as f:
14 f.write(response.text)
15 print(f"[SUCCESS] Exploit {exploit_id} downloaded successfully.")
16 else:
17 print(f"[FAILED] Exploit {exploit_id}: HTTP {response.status_code}")
18 except Exception as e:
19 print(f"[ERROR] An error occurred while downloading exploit {exploit_id}: {e}")
20
21if __name__ == "__main__":
22 os.makedirs("exploit-analyzer/exploits", exist_ok=True)
23 start_id = 1
24 end_id = 10000
25 delay = 1 # Delay em segundos entre downloads para evitar bloqueio
26
27 for exploit_id in range(start_id, end_id + 1):
28 download_exploit(exploit_id, "exploit-analyzer/exploits")
29 time.sleep(delay) # Pausa entre requisições
30 