@@ -30,9 +30,8 @@ def initialize
30
30
'Actions' => [
31
31
[ 'john' , { 'Description' => 'Use John the Ripper' } ] ,
32
32
[ 'hashcat' , { 'Description' => 'Use Hashcat' } ] ,
33
- [ 'auto' , { 'Description' => 'Use either John the Ripper or Hashcat, if both are present, use Hashcat' } ]
34
33
] ,
35
- 'DefaultAction' => 'auto ' ,
34
+ 'DefaultAction' => 'john ' ,
36
35
'Notes' => {
37
36
'Stability' => [ CRASH_SAFE ] ,
38
37
'SideEffects' => [ ] ,
@@ -63,11 +62,9 @@ def half_lm_regex
63
62
def show_command ( cracker_instance )
64
63
return unless datastore [ 'ShowCommand' ]
65
64
66
- newaction = getaction ( )
67
-
68
- if newaction == 'john'
65
+ if action . name == 'john'
69
66
cmd = cracker_instance . john_crack_command
70
- elsif newaction == 'hashcat'
67
+ elsif action . name == 'hashcat'
71
68
cmd = cracker_instance . hashcat_crack_command
72
69
end
73
70
print_status ( " Cracking Command: #{ cmd . join ( ' ' ) } " )
@@ -99,16 +96,13 @@ def process_cracker_results(results, cred)
99
96
end
100
97
101
98
def check_results ( passwords , results , hash_type , method )
102
-
103
- newaction = getaction ( )
104
-
105
99
passwords . each do |password_line |
106
100
password_line . chomp!
107
101
next if password_line . blank?
108
102
109
103
fields = password_line . split ( ':' )
110
104
cred = { 'hash_type' => hash_type , 'method' => method }
111
- if newaction == 'john'
105
+ if action . name == 'john'
112
106
# If we don't have an expected minimum number of fields, this is probably not a hash line
113
107
next unless fields . count > 2
114
108
@@ -142,7 +136,7 @@ def check_results(passwords, results, hash_type, method)
142
136
cred [ 'password' ] = john_lm_upper_to_ntlm ( password , nt_hash )
143
137
end
144
138
next if cred [ 'password' ] . nil?
145
- elsif newaction == 'hashcat'
139
+ elsif action . name == 'hashcat'
146
140
next unless fields . count >= 2
147
141
148
142
cred [ 'core_id' ] = fields . shift
@@ -169,9 +163,6 @@ def check_results(passwords, results, hash_type, method)
169
163
end
170
164
171
165
def run
172
-
173
- newaction = getaction ( )
174
-
175
166
tbl = cracker_results_table
176
167
177
168
# array of hashes in jtr_format in the db, converted to an OR combined regex
@@ -187,7 +178,7 @@ def run
187
178
188
179
# build our job list
189
180
hash_types_to_crack . each do |hash_type |
190
- job = hash_job ( hash_type , newaction )
181
+ job = hash_job ( hash_type , action . name )
191
182
if job . nil?
192
183
print_status ( "No #{ hash_type } found to crack" )
193
184
else
@@ -205,7 +196,7 @@ def run
205
196
# Inner array format: db_id, hash_type, username, password, method_of_crack
206
197
results = [ ]
207
198
208
- cracker = new_password_cracker ( newaction )
199
+ cracker = new_password_cracker ( action . name )
209
200
210
201
# generate our wordlist and close the file handle.
211
202
wordlist = wordlist_file
@@ -229,7 +220,7 @@ def run
229
220
# dupe our original cracker so we can safely change options between each run
230
221
cracker_instance = cracker . dup
231
222
cracker_instance . format = format
232
- if newaction == 'john'
223
+ if action . name == 'john'
233
224
cracker_instance . fork = datastore [ 'FORK' ]
234
225
end
235
226
@@ -240,7 +231,7 @@ def run
240
231
job [ 'cred_ids_left_to_crack' ] = job [ 'cred_ids_left_to_crack' ] - results . map { |i | i [ 0 ] . to_i } # remove cracked hashes from the hash list
241
232
next if job [ 'cred_ids_left_to_crack' ] . empty?
242
233
243
- if newaction == 'john'
234
+ if action . name == 'john'
244
235
print_status "Cracking #{ format } hashes in single mode..."
245
236
cracker_instance . mode_single ( wordlist . path )
246
237
show_command cracker_instance
@@ -283,7 +274,7 @@ def run
283
274
print_status "Cracking #{ format } hashes in wordlist mode..."
284
275
cracker_instance . mode_wordlist ( wordlist . path )
285
276
# Turn on KoreLogic rules if the user asked for it
286
- if newaction == 'john' && datastore [ 'KORELOGIC' ]
277
+ if action . name == 'john' && datastore [ 'KORELOGIC' ]
287
278
cracker_instance . rules = 'KoreLogicRules'
288
279
print_status 'Applying KoreLogic ruleset...'
289
280
end
@@ -308,24 +299,4 @@ def run
308
299
end
309
300
end
310
301
end
311
-
312
- def getaction
313
- newaction = action . name
314
- if action . name == 'auto'
315
- path = Rex ::FileUtils . find_full_path ( 'hashcat' ) ||
316
- Rex ::FileUtils . find_full_path ( 'hashcat.exe' )
317
- if path
318
- newaction = 'hashcat'
319
- else
320
- path = Rex ::FileUtils . find_full_path ( 'john' ) ||
321
- Rex ::FileUtils . find_full_path ( 'john.exe' )
322
- if path
323
- newaction = 'john'
324
- else
325
- raise PasswordCrackerNotFoundError , 'No suitable john/hashcat binary was found on the system'
326
- end
327
- end
328
- end
329
- return newaction
330
- end
331
302
end
0 commit comments