@@ -34,9 +34,8 @@ def initialize
34
34
'Actions' => [
35
35
[ 'john' , { 'Description' => 'Use John the Ripper' } ] ,
36
36
[ 'hashcat' , { 'Description' => 'Use Hashcat' } ] ,
37
- [ 'auto' , { 'Description' => 'Use either John the Ripper or Hashcat, if both are present, use Hashcat' } ]
38
37
] ,
39
- 'DefaultAction' => 'auto ' ,
38
+ 'DefaultAction' => 'john ' ,
40
39
'Notes' => {
41
40
'Stability' => [ CRASH_SAFE ] ,
42
41
'SideEffects' => [ ] ,
@@ -59,34 +58,29 @@ def initialize
59
58
def show_command ( cracker_instance )
60
59
return unless datastore [ 'ShowCommand' ]
61
60
62
- newaction = getaction ( )
63
-
64
- if newaction == 'john'
61
+ if action . name == 'john'
65
62
cmd = cracker_instance . john_crack_command
66
- elsif newaction == 'hashcat'
63
+ elsif action . name == 'hashcat'
67
64
cmd = cracker_instance . hashcat_crack_command
68
65
end
69
66
print_status ( " Cracking Command: #{ cmd . join ( ' ' ) } " )
70
67
end
71
68
72
69
def check_results ( passwords , results , hash_type , method )
73
-
74
- newaction = getaction ( )
75
-
76
70
passwords . each do |password_line |
77
71
password_line . chomp!
78
72
next if password_line . blank?
79
73
80
74
fields = password_line . split ( ':' )
81
75
cred = { 'hash_type' => hash_type , 'method' => method }
82
76
83
- if newaction == 'john'
77
+ if action . name == 'john'
84
78
next unless fields . count >= 3
85
79
86
80
cred [ 'username' ] = fields . shift
87
81
cred [ 'core_id' ] = fields . pop
88
82
cred [ 'password' ] = fields . join ( ':' ) # Anything left must be the password. This accounts for passwords with semi-colons in it
89
- elsif newaction == 'hashcat'
83
+ elsif action . name == 'hashcat'
90
84
next unless fields . count >= 2
91
85
92
86
cred [ 'core_id' ] = fields . shift
@@ -115,9 +109,6 @@ def check_results(passwords, results, hash_type, method)
115
109
end
116
110
117
111
def run
118
-
119
- newaction = getaction ( )
120
-
121
112
tbl = tbl = cracker_results_table
122
113
123
114
# array of hashes in jtr_format in the db, converted to an OR combined regex
@@ -137,7 +128,7 @@ def run
137
128
138
129
# hashcat requires a format we dont have all the data for
139
130
# in the current dumper, so this is disabled in module and lib
140
- if newaction == 'john'
131
+ if action . name == 'john'
141
132
hash_types_to_crack << 'oracle'
142
133
hash_types_to_crack << 'dynamic_1506'
143
134
end
@@ -152,7 +143,7 @@ def run
152
143
153
144
# build our job list
154
145
hash_types_to_crack . each do |hash_type |
155
- job = hash_job ( hash_type , newaction )
146
+ job = hash_job ( hash_type , action . name )
156
147
if job . nil?
157
148
print_status ( "No #{ hash_type } found to crack" )
158
149
else
@@ -170,7 +161,7 @@ def run
170
161
# Inner array format: db_id, hash_type, username, password, method_of_crack
171
162
results = [ ]
172
163
173
- cracker = new_password_cracker ( newaction )
164
+ cracker = new_password_cracker ( action . name )
174
165
175
166
# generate our wordlist and close the file handle.
176
167
wordlist = wordlist_file
@@ -196,7 +187,7 @@ def run
196
187
cracker_instance = cracker . dup
197
188
cracker_instance . format = format
198
189
199
- if newaction == 'john'
190
+ if action . name == 'john'
200
191
cracker_instance . fork = datastore [ 'FORK' ]
201
192
end
202
193
@@ -207,7 +198,7 @@ def run
207
198
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
208
199
next if job [ 'cred_ids_left_to_crack' ] . empty?
209
200
210
- if newaction == 'john'
201
+ if action . name == 'john'
211
202
print_status "Cracking #{ format } hashes in single mode..."
212
203
cracker_instance . mode_single ( wordlist . path )
213
204
show_command cracker_instance
@@ -248,7 +239,7 @@ def run
248
239
print_status "Cracking #{ format } hashes in wordlist mode..."
249
240
cracker_instance . mode_wordlist ( wordlist . path )
250
241
# Turn on KoreLogic rules if the user asked for it
251
- if newaction == 'john' && datastore [ 'KORELOGIC' ]
242
+ if action . name == 'john' && datastore [ 'KORELOGIC' ]
252
243
cracker_instance . rules = 'KoreLogicRules'
253
244
print_status 'Applying KoreLogic ruleset...'
254
245
end
@@ -272,25 +263,4 @@ def run
272
263
end
273
264
end
274
265
end
275
-
276
- def getaction
277
- newaction = action . name
278
- if action . name == 'auto'
279
- path = Rex ::FileUtils . find_full_path ( 'hashcat' ) ||
280
- Rex ::FileUtils . find_full_path ( 'hashcat.exe' )
281
- if path
282
- newaction = 'hashcat'
283
- else
284
- path = Rex ::FileUtils . find_full_path ( 'john' ) ||
285
- Rex ::FileUtils . find_full_path ( 'john.exe' )
286
- if path
287
- newaction = 'john'
288
- else
289
- raise PasswordCrackerNotFoundError , 'No suitable john/hashcat binary was found on the system'
290
- end
291
- end
292
- end
293
- return newaction
294
- end
295
-
296
266
end
0 commit comments