mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-07-28 22:51:14 -07:00
fix(hashview-download): append found hashes to left file, fix rsplit for NTLMv2
This commit is contained in:
+7
-1
@@ -1428,7 +1428,7 @@ class HashviewAPI:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line:
|
||||
parts = line.split(":", 1) # Split on first colon
|
||||
parts = line.rsplit(":", 1)
|
||||
if len(parts) == 2:
|
||||
hash_part, clear_part = parts
|
||||
hf.write(hash_part + "\n")
|
||||
@@ -1436,6 +1436,12 @@ class HashviewAPI:
|
||||
hashes_count += 1
|
||||
clears_count += 1
|
||||
|
||||
# Append found hashes to the left file to reconstruct the full hashlist
|
||||
with open(output_abs, "a", encoding="utf-8") as lf:
|
||||
with open(found_hashes_file, "r", encoding="utf-8") as hf:
|
||||
for line in hf:
|
||||
lf.write(line)
|
||||
|
||||
print(
|
||||
f"Split found file into {hashes_count} hashes and {clears_count} clears"
|
||||
)
|
||||
|
||||
@@ -644,14 +644,14 @@ class TestHashviewAPI:
|
||||
# Verify left file was created
|
||||
assert os.path.exists(result["output_file"])
|
||||
|
||||
# Verify left file contains only the original uncracked hashes
|
||||
# Verify left file contains the full original hashlist (left + found)
|
||||
with open(result["output_file"], "r") as f:
|
||||
left_contents = f.read()
|
||||
assert "found_hash1" not in left_contents, (
|
||||
"Found hashes must NOT be written back into the left file"
|
||||
assert "found_hash1" in left_contents, (
|
||||
"Found hashes must be appended to the left file to reconstruct the full hashlist"
|
||||
)
|
||||
assert "found_hash2" not in left_contents, (
|
||||
"Found hashes must NOT be written back into the left file"
|
||||
assert "found_hash2" in left_contents, (
|
||||
"Found hashes must be appended to the left file to reconstruct the full hashlist"
|
||||
)
|
||||
assert "uncracked_hash1" in left_contents
|
||||
assert "uncracked_hash2" in left_contents
|
||||
|
||||
Reference in New Issue
Block a user