Skip to content

Commit

Permalink
Merge pull request #8 from s3inlc/current-dev
Browse files Browse the repository at this point in the history
Including changes for next release
  • Loading branch information
s3inlc authored Feb 11, 2020
2 parents 9acfeda + bcc022d commit 9d580f2
Show file tree
Hide file tree
Showing 11 changed files with 865 additions and 688 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ __pycache__
*.zip
.idea
venv
lock.pid
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ In order to use the multicast distribution for files, please make sure that the

The list contains all Hashcat versions with which the client was tested and is able to work with (other versions might work):

* 6.0.0
* 5.1.0
* 5.0.0
* 4.2.1
* 4.2.0
Expand Down
15 changes: 10 additions & 5 deletions __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,14 @@ def loop():
task_change = True
task.reset_task()
continue
# if prince is used, make sure it's downloaded
if task.get_task()['usePrince']:
binaryDownload.check_prince()
# if prince is used, make sure it's downloaded (deprecated, as preprocessors are integrated generally now)
if 'usePrince' in task.get_task() and task.get_task()['usePrince']:
if not binaryDownload.check_prince():
continue
# if preprocessor is used, make sure it's downloaded
if 'usePreprocessor' in task.get_task() and task.get_task()['usePreprocessor']:
if not binaryDownload.check_preprocessor(task):
continue
# check if all required files are present
if not files.check_files(task.get_task()['files'], task.get_task()['taskId']):
task.reset_task()
Expand All @@ -204,7 +209,7 @@ def loop():
continue
elif chunk_resp == -1:
# measure keyspace
if not cracker.measure_keyspace(task.get_task(), chunk): # failure case
if not cracker.measure_keyspace(task, chunk): # failure case
task.reset_task()
continue
elif chunk_resp == -3:
Expand Down Expand Up @@ -249,7 +254,7 @@ def loop():

# run chunk
logging.info("Start chunk...")
cracker.run_chunk(task.get_task(), chunk.chunk_data())
cracker.run_chunk(task.get_task(), chunk.chunk_data(), task.get_preprocessor())
if cracker.agent_stopped():
# if the chunk was aborted by a stop from the server, we need to ask for a task again first
task.reset_task()
Expand Down
11 changes: 11 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## v0.5.0 -> v0.6.0

### Features

* Generic integration of preprocessors.
* Added compatibility for newer Hashcat versions with different outfile format specification.

### Bugfixes

* Fixed crash handling on generic cracker for invalid binary names

## v0.4.0 -> v0.5.0

### Enhancements
Expand Down
39 changes: 39 additions & 0 deletions htpclient/binarydownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,45 @@ def check_prince(self):
os.rmdir("temp")
logging.debug("PRINCE downloaded and extracted")
return True

def check_preprocessor(self, task):
logging.debug("Checking if requested preprocessor is present...")
path = "preprocessor/" + str(task.get_task()['preprocessor']) + "/"
query = copy_and_set_token(dict_downloadBinary, self.config.get_value('token'))
query['type'] = 'preprocessor'
query['preprocessorId'] = task.get_task()['preprocessor']
req = JsonRequest(query)
ans = req.execute()
if ans is None:
logging.error("Failed to load preprocessor settings!")
sleep(5)
return False
elif ans['response'] != 'SUCCESS' or not ans['url']:
logging.error("Getting preprocessor settings failed: " + str(ans))
sleep(5)
return False
else:
task.set_preprocessor(ans)
if os.path.isdir(path): # if it already exists, we don't need to download it
logging.debug("Preprocessor is already downloaded")
return True
logging.debug("Preprocessor not found, download...")
if not Download.download(ans['url'], "temp.7z"):
logging.error("Download of preprocessor failed!")
sleep(5)
return False
if Initialize.get_os() == 1:
os.system("7zr" + Initialize.get_os_extension() + " x -otemp temp.7z")
else:
os.system("./7zr" + Initialize.get_os_extension() + " x -otemp temp.7z")
for name in os.listdir("temp"): # this part needs to be done because it is compressed with the main subfolder of prince
if os.path.isdir("temp/" + name):
os.rename("temp/" + name, path)
break
os.unlink("temp.7z")
os.rmdir("temp")
logging.debug("Preprocessor downloaded and extracted")
return True

def check_version(self, cracker_id):
path = "crackers/" + str(cracker_id) + "/"
Expand Down
Loading

0 comments on commit 9d580f2

Please sign in to comment.