def update_modes(cls): """ This method updates the dictionary containing the hashcat supported hash algorithms. Run this with every hashcat update if you want the latest hash types. """ hc = Hashcat() hc.hwmon_disable = True hc.usage = True hc.left = False hc.logfile_disable = True hc.spin_damp = 0 hc.potfile_disable = True hc.show = False hc.session = 'usage' hc.backend_info = True hc.quiet = True print("[+] Running hashcat") if hc.hashcat_session_execute() >= 0: hashm_dict = hc.hashcat_list_hashmodes() if isinstance(hashm_dict, dict): print('[+] Hashmodes list gathered') print('[+] Updating Hash Modes dictionary') hashm_file = '/var/crackq/files/hashm_dict.json' print('[+] Writing dicitonary to file: {}'.format(hashm_file)) with open(hashm_file, 'w') as fh_hashm: fh_hashm.write(json.dumps(hashm_dict)) print('[+] Done')
from pyhashcat import Hashcat bench_dict = {} finished = False hc = Hashcat() hc.hwmon_disable = True hc.usage = True hc.left = False hc.logfile_disable = True hc.spin_damp = 0 hc.potfile_disable = True hc.show = False hc.session = 'usage' # Using backend_info at the moment as a small hack to get # usage only with out full hc execution hc.backend_info = True hc.quiet = True print("[+] Running hashcat") if hc.hashcat_session_execute() >= 0: hashm_dict = hc.hashcat_list_hashmodes() if isinstance(hashm_dict, dict): print('[+] Hashmodes list gathered') bench_file = '/var/crackq/files/sys_benchmark.txt' print('[+] Reading System Benchmark Report from {}'.format(bench_file)) with open(bench_file, 'r') as fh_bench: bench_dict = json.loads(fh_bench.read()) print('[+] Updating Hash Modes dictionary') missing_list = []