Fetching more kali images

This commit is contained in:
Kasper Plougmann 2025-07-08 21:20:19 +02:00 committed by GitHub
parent 498b0a7039
commit 0cfeb056a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -100,20 +100,26 @@ def fetch_arch_latest():
return download_torrent("archlinux-latest", torrent_url) return download_torrent("archlinux-latest", torrent_url)
def fetch_kali_latest(): def fetch_kali_latest():
T_PATTERN = re.compile(r"kali-linux-(\d+\.\d+)-installer(?:-(netinst|everything))?-amd64\.iso\.torrent$")
url = "https://www.kali.org/get-kali/#kali-installer-images" url = "https://www.kali.org/get-kali/#kali-installer-images"
try: try:
r = requests.get(url, timeout=30) r = requests.get(url, timeout=30)
r.raise_for_status() r.raise_for_status()
soup = BeautifulSoup(r.text, "html.parser") soup = BeautifulSoup(r.text, "html.parser")
for link in soup.find_all('a', href=True): results = {}
href = link['href']
if href.endswith(".torrent"): for a in soup.find_all("a", href=True):
torrent_url = href href = a["href"]
if T_PATTERN.search(href):
name = os.path.basename(href).replace(".torrent", "") name = os.path.basename(href).replace(".torrent", "")
return download_torrent(name, torrent_url) results[name] = download_torrent(name, href)
logging.warning("No Kali torrent found.")
return False if not results:
logging.warning("No Kali installer torrents found.")
return False # or return {} if you prefer
return results
except Exception as e: except Exception as e:
logging.error(f"Kali fetch error: {e}") logging.error(f"Kali fetch error: {e}")
return False return False