Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion htpclient/generic_cracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def run_loop(self, process, chunk, task):
query['keyspaceProgress'] = chunk['skip']
query['relativeProgress'] = progress
query['speed'] = speed
query['state'] = (4 if progress == 10000 else 2)
query['state'] = (5 if progress == 10000 else 3)
query['cracks'] = cracks
req = JsonRequest(query)

Expand Down
4 changes: 2 additions & 2 deletions htpclient/hashcat_cracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def run_loop(self, proc, chunk, task):
query['keyspaceProgress'] = chunk['skip']
query['relativeProgress'] = 0
query['speed'] = 0
query['state'] = 2
query['state'] = 3
query['cracks'] = []
req = JsonRequest(query)
logging.info("Sending keepalive progress to avoid timeout...")
Expand Down Expand Up @@ -426,7 +426,7 @@ def run_loop(self, proc, chunk, task):
relative_progress = 0
speed = status.get_speed()
initial = True
if status.get_state() == 4 or status.get_state() == 5:
if status.get_state() == 5 or status.get_state() == 6:
time.sleep(5) # we wait five seconds so all output is loaded from file
# reset piping stuff when a chunk is successfully finished
self.progressVal = 0
Expand Down
3 changes: 2 additions & 1 deletion htpclient/hashcat_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def get_progress(self):
return self.progress[0]

def get_state(self):
return self.status - 1
"""Hashcat's raw status code, kept in sync with the server's DHashcatStatus enum."""
return self.status

def get_curku(self):
return self.curku
Expand Down
6 changes: 6 additions & 0 deletions tests/test_hashcat_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,11 @@ def test_get_util(self):
status = HashcatStatus(line)
self.assertEqual(status.get_util(), (85 + 90) // 2)

def test_get_state_returns_raw_hashcat_status(self):
"""get_state() returns hashcat's raw status code, matching the server's DHashcatStatus enum."""
for state in (0, 1, 2, 3, 5, 6, 7, 11, 13, 14, 16):
status = HashcatStatus(f"STATUS\t{state}\tSPEED\t1000\t1000")
self.assertEqual(status.get_state(), state)

if __name__ == '__main__':
unittest.main()
Loading