Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion htpclient/hashcat_cracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ def run_loop(self, proc, chunk, task):
else:
identifier, line = item
if identifier == 'OUT':
# "7.1.2" -> (7,1,2)
# "7.1.2-546-gc885beef" -> (7,1,2,546)
version_list = self.version_string.replace('-', '.').split('.')[:4] # Chop off anything past the fourth field (for example commit hash)
version_tuple = tuple(int(s) for s in version_list)
status = HashcatStatus(line.decode())
if status.is_valid():
self.statusCount += 1
Expand Down Expand Up @@ -344,7 +348,12 @@ def run_loop(self, proc, chunk, task):
# we need to calculate the chunk start, because progress does not start at 0 for a chunk
chunk_start = int(status.get_progress_total() / (chunk['skip'] + chunk['length']) * chunk['skip'])
if total > 0:
relative_progress = int((status.get_progress() - chunk_start) / float(total - chunk_start) * 10000)
if version_tuple >= (7, 1, 2, 546):
relative_progress = int(status.get_progress() / total * 10000)
else:
# before hashcat 7.1.2-546, the PROGRESS fields included the skip value.
# Adjust for this offset
relative_progress = int((status.get_progress() - chunk_start) / float(total - chunk_start) * 10000)
else: # this is the case when we cannot say anything about the progress
relative_progress = 0
speed = status.get_speed()
Expand Down