mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-07-28 22:51:14 -07:00
feat(api): skip already-present wordlists in list_and_download_official_wordlists
Before each download in both the 'all' and indexed-selection branches, check whether the destination file already exists and has nonzero size (accounting for .7z archives whose extracted name drops the suffix). Mirrors the same guard already in place for rule downloads. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
11b575d5a6
commit
979953cf45
@@ -1677,6 +1677,17 @@ def list_and_download_official_wordlists():
|
||||
)
|
||||
if sel.lower() == "q":
|
||||
return
|
||||
dest_dir = get_hcat_wordlists_dir()
|
||||
|
||||
def _already_downloaded_wordlist(file_name):
|
||||
sanitized = sanitize_filename(file_name)
|
||||
if sanitized.endswith(".7z"):
|
||||
extracted_name = sanitized[:-3]
|
||||
check_path = os.path.join(dest_dir, extracted_name)
|
||||
else:
|
||||
check_path = os.path.join(dest_dir, sanitized)
|
||||
return os.path.isfile(check_path) and os.path.getsize(check_path) > 0
|
||||
|
||||
if sel.lower() == "a":
|
||||
try:
|
||||
for entry in data:
|
||||
@@ -1684,6 +1695,9 @@ def list_and_download_official_wordlists():
|
||||
if not file_name:
|
||||
print("No file_name found for an entry, skipping.")
|
||||
continue
|
||||
if _already_downloaded_wordlist(file_name):
|
||||
print(f"[i] Skipping {file_name} (already present)")
|
||||
continue
|
||||
out_path = entry.get("file_name", file_name)
|
||||
download_official_wordlist(file_name, out_path)
|
||||
except KeyboardInterrupt:
|
||||
@@ -1723,6 +1737,9 @@ def list_and_download_official_wordlists():
|
||||
if not file_name:
|
||||
print("No file_name found for selection, skipping.")
|
||||
continue
|
||||
if _already_downloaded_wordlist(file_name):
|
||||
print(f"[i] Skipping {file_name} (already present)")
|
||||
continue
|
||||
out_path = entry.get("file_name", file_name)
|
||||
download_official_wordlist(file_name, out_path)
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user