Skip to content

Commit 9d580f2

Browse files
authored
Merge pull request #8 from s3inlc/current-dev
Including changes for next release
2 parents 9acfeda + bcc022d commit 9d580f2

File tree

11 files changed

+865
-688
lines changed

11 files changed

+865
-688
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ __pycache__
1010
*.zip
1111
.idea
1212
venv
13+
lock.pid

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ In order to use the multicast distribution for files, please make sure that the
110110

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

113+
* 6.0.0
114+
* 5.1.0
113115
* 5.0.0
114116
* 4.2.1
115117
* 4.2.0

__main__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,14 @@ def loop():
175175
task_change = True
176176
task.reset_task()
177177
continue
178-
# if prince is used, make sure it's downloaded
179-
if task.get_task()['usePrince']:
180-
binaryDownload.check_prince()
178+
# if prince is used, make sure it's downloaded (deprecated, as preprocessors are integrated generally now)
179+
if 'usePrince' in task.get_task() and task.get_task()['usePrince']:
180+
if not binaryDownload.check_prince():
181+
continue
182+
# if preprocessor is used, make sure it's downloaded
183+
if 'usePreprocessor' in task.get_task() and task.get_task()['usePreprocessor']:
184+
if not binaryDownload.check_preprocessor(task):
185+
continue
181186
# check if all required files are present
182187
if not files.check_files(task.get_task()['files'], task.get_task()['taskId']):
183188
task.reset_task()
@@ -204,7 +209,7 @@ def loop():
204209
continue
205210
elif chunk_resp == -1:
206211
# measure keyspace
207-
if not cracker.measure_keyspace(task.get_task(), chunk): # failure case
212+
if not cracker.measure_keyspace(task, chunk): # failure case
208213
task.reset_task()
209214
continue
210215
elif chunk_resp == -3:
@@ -249,7 +254,7 @@ def loop():
249254

250255
# run chunk
251256
logging.info("Start chunk...")
252-
cracker.run_chunk(task.get_task(), chunk.chunk_data())
257+
cracker.run_chunk(task.get_task(), chunk.chunk_data(), task.get_preprocessor())
253258
if cracker.agent_stopped():
254259
# if the chunk was aborted by a stop from the server, we need to ask for a task again first
255260
task.reset_task()

changelog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## v0.5.0 -> v0.6.0
2+
3+
### Features
4+
5+
* Generic integration of preprocessors.
6+
* Added compatibility for newer Hashcat versions with different outfile format specification.
7+
8+
### Bugfixes
9+
10+
* Fixed crash handling on generic cracker for invalid binary names
11+
112
## v0.4.0 -> v0.5.0
213

314
### Enhancements

htpclient/binarydownload.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,45 @@ def check_prince(self):
132132
os.rmdir("temp")
133133
logging.debug("PRINCE downloaded and extracted")
134134
return True
135+
136+
def check_preprocessor(self, task):
137+
logging.debug("Checking if requested preprocessor is present...")
138+
path = "preprocessor/" + str(task.get_task()['preprocessor']) + "/"
139+
query = copy_and_set_token(dict_downloadBinary, self.config.get_value('token'))
140+
query['type'] = 'preprocessor'
141+
query['preprocessorId'] = task.get_task()['preprocessor']
142+
req = JsonRequest(query)
143+
ans = req.execute()
144+
if ans is None:
145+
logging.error("Failed to load preprocessor settings!")
146+
sleep(5)
147+
return False
148+
elif ans['response'] != 'SUCCESS' or not ans['url']:
149+
logging.error("Getting preprocessor settings failed: " + str(ans))
150+
sleep(5)
151+
return False
152+
else:
153+
task.set_preprocessor(ans)
154+
if os.path.isdir(path): # if it already exists, we don't need to download it
155+
logging.debug("Preprocessor is already downloaded")
156+
return True
157+
logging.debug("Preprocessor not found, download...")
158+
if not Download.download(ans['url'], "temp.7z"):
159+
logging.error("Download of preprocessor failed!")
160+
sleep(5)
161+
return False
162+
if Initialize.get_os() == 1:
163+
os.system("7zr" + Initialize.get_os_extension() + " x -otemp temp.7z")
164+
else:
165+
os.system("./7zr" + Initialize.get_os_extension() + " x -otemp temp.7z")
166+
for name in os.listdir("temp"): # this part needs to be done because it is compressed with the main subfolder of prince
167+
if os.path.isdir("temp/" + name):
168+
os.rename("temp/" + name, path)
169+
break
170+
os.unlink("temp.7z")
171+
os.rmdir("temp")
172+
logging.debug("Preprocessor downloaded and extracted")
173+
return True
135174

136175
def check_version(self, cracker_id):
137176
path = "crackers/" + str(cracker_id) + "/"

0 commit comments

Comments
 (0)