33import json
44import sys
55import os
6+ import re
67
78
89class 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"
1718binary = sys .argv [1 ] # The hashcat binary is the first argument
1819if 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
3940for 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):
5458print ('if (!isset($PRESENT["PLACEHOLDER"])){' )
5559print (" $hashTypes = [" )
5660for 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 (" ]; " )
5963print (' foreach ($hashtypes as $hashtype) {' )
6064print (' $check = Factory::getHashTypeFactory()->get($hashtype->getId());' )
6165print (' if ($check === null) {' )
@@ -68,3 +72,6 @@ def __init__(self, hashType, description, salted, slowHash):
6872print ("Add the following to the install script:" )
6973for 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