Skip to content

Commit adc3989

Browse files
author
jessevz
committed
update-hashes.py now understand new format
1 parent 87aa54b commit adc3989

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

ci/files/update-hashes.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import json
44
import sys
55
import os
6+
import re
67

78

89
class HashType:
@@ -13,7 +14,7 @@ def __init__(self, hashType, description, salted, slowHash):
1314
self.slowHash = slowHash
1415

1516

16-
url = "https://raw.githubusercontent.com/hashcat/hashcat/refs/tags/v7.0.0/docs/hashcat-example_hashes.md"
17+
url = "https://raw.githubusercontent.com/hashcat/hashcat/refs/tags/v7.1.1/docs/hashcat-example-hashes.md"
1718
binary = sys.argv[1] # The hashcat binary is the first argument
1819
if not os.path.isfile(binary):
1920
print("usage: python3 update-hashes.py <hashcat binary>")
@@ -38,8 +39,11 @@ def __init__(self, hashType, description, salted, slowHash):
3839

3940
for line in lines[4:]: # skip first 4 header lines
4041
splitted = line.split("|")
41-
hashType = splitted[1].strip().strip("`")
42-
description = splitted[2].strip().strip("`")
42+
if len(splitted) == 1: # table is finished
43+
break
44+
hashType = re.search(r"\[`?(\d+)`?\]", splitted[1]).group(1)
45+
description = splitted[2].strip().split("`")[1]
46+
print(description)
4347
r = requests.get(url + hashType, headers=headers)
4448
if (r.status_code != 200):
4549
args[2] = hashType
@@ -54,8 +58,8 @@ def __init__(self, hashType, description, salted, slowHash):
5458
print('if (!isset($PRESENT["PLACEHOLDER"])){')
5559
print(" $hashTypes = [")
5660
for hashType in new_hashtypes:
57-
print(f' new HashType( {hashType.hashType}, "{hashType.description}", {int(hashType.salted)}, {int(hashType.slowHash)}),')
58-
print(" ]")
61+
print(f' new HashType( {hashType.hashType}, "{hashType.description}", {int(hashType.salted)}, {int(hashType.slowHash)}),')
62+
print(" ];")
5963
print(' foreach ($hashtypes as $hashtype) {')
6064
print(' $check = Factory::getHashTypeFactory()->get($hashtype->getId());')
6165
print(' if ($check === null) {')
@@ -68,3 +72,6 @@ def __init__(self, hashType, description, salted, slowHash):
6872
print("Add the following to the install script:")
6973
for hashType in new_hashtypes:
7074
print(f" ({hashType.hashType}, '{hashType.description}', {int(hashType.salted)}, {int(hashType.slowHash)}),")
75+
76+
77+
print("Dont forgot to check if all hashtypes where salted = '1', are actually salted in a way that Hashtopolis understands!")

0 commit comments

Comments
 (0)