@@ -59,29 +59,29 @@ def initialize
59
59
def show_command ( cracker_instance )
60
60
return unless datastore [ 'ShowCommand' ]
61
61
62
- if cracker_instance . cracker == 'john'
62
+ if @cracker_type == 'john'
63
63
cmd = cracker_instance . john_crack_command
64
- elsif cracker_instance . cracker == 'hashcat'
64
+ elsif @cracker_type == 'hashcat'
65
65
cmd = cracker_instance . hashcat_crack_command
66
66
end
67
67
print_status ( " Cracking Command: #{ cmd . join ( ' ' ) } " )
68
68
end
69
69
70
- def check_results ( passwords , results , hash_type , method , cracker_type )
70
+ def check_results ( passwords , results , hash_type , method )
71
71
passwords . each do |password_line |
72
72
password_line . chomp!
73
73
next if password_line . blank?
74
74
75
75
fields = password_line . split ( ':' )
76
76
cred = { 'hash_type' => hash_type , 'method' => method }
77
77
78
- if cracker_type == 'john'
78
+ if @ cracker_type == 'john'
79
79
next unless fields . count >= 3
80
80
81
81
cred [ 'username' ] = fields . shift
82
82
cred [ 'core_id' ] = fields . pop
83
83
cred [ 'password' ] = fields . join ( ':' ) # Anything left must be the password. This accounts for passwords with semi-colons in it
84
- elsif cracker_type == 'hashcat'
84
+ elsif @ cracker_type == 'hashcat'
85
85
next unless fields . count >= 2
86
86
87
87
cred [ 'core_id' ] = fields . shift
@@ -112,6 +112,11 @@ def check_results(passwords, results, hash_type, method, cracker_type)
112
112
def run
113
113
tbl = cracker_results_table
114
114
cracker = new_password_cracker ( action . name )
115
+ if action . name == 'auto'
116
+ @cracker_type = cracker . get_type
117
+ else
118
+ @cracker_type = action . name
119
+ end
115
120
116
121
# array of hashes in jtr_format in the db, converted to an OR combined regex
117
122
hash_types_to_crack = [ ]
@@ -130,7 +135,7 @@ def run
130
135
131
136
# hashcat requires a format we dont have all the data for
132
137
# in the current dumper, so this is disabled in module and lib
133
- if cracker . cracker == 'john'
138
+ if @cracker_type == 'john'
134
139
hash_types_to_crack << 'oracle'
135
140
hash_types_to_crack << 'dynamic_1506'
136
141
end
@@ -187,25 +192,25 @@ def run
187
192
cracker_instance = cracker . dup
188
193
cracker_instance . format = format
189
194
190
- if cracker . cracker == 'john'
195
+ if @cracker_type == 'john'
191
196
cracker_instance . fork = datastore [ 'FORK' ]
192
197
end
193
198
194
199
# first check if anything has already been cracked so we don't report it incorrectly
195
200
print_status "Checking #{ format } hashes already cracked..."
196
- results = check_results ( cracker_instance . each_cracked_password , results , format , 'Already Cracked/POT' , cracker . cracker )
201
+ results = check_results ( cracker_instance . each_cracked_password , results , format , 'Already Cracked/POT' )
197
202
vprint_good ( append_results ( tbl , results ) ) unless results . empty?
198
203
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
199
204
next if job [ 'cred_ids_left_to_crack' ] . empty?
200
205
201
- if cracker . cracker == 'john'
206
+ if @cracker_type == 'john'
202
207
print_status "Cracking #{ format } hashes in single mode..."
203
208
cracker_instance . mode_single ( wordlist . path )
204
209
show_command cracker_instance
205
210
cracker_instance . crack do |line |
206
211
vprint_status line . chomp
207
212
end
208
- results = check_results ( cracker_instance . each_cracked_password , results , format , 'Single' , cracker . cracker )
213
+ results = check_results ( cracker_instance . each_cracked_password , results , format , 'Single' )
209
214
vprint_good ( append_results ( tbl , results ) ) unless results . empty?
210
215
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
211
216
next if job [ 'cred_ids_left_to_crack' ] . empty?
@@ -216,7 +221,7 @@ def run
216
221
cracker_instance . crack do |line |
217
222
vprint_status line . chomp
218
223
end
219
- results = check_results ( cracker_instance . each_cracked_password , results , format , 'Normal' , cracker . cracker )
224
+ results = check_results ( cracker_instance . each_cracked_password , results , format , 'Normal' )
220
225
vprint_good ( append_results ( tbl , results ) ) unless results . empty?
221
226
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
222
227
next if job [ 'cred_ids_left_to_crack' ] . empty?
@@ -229,7 +234,7 @@ def run
229
234
cracker_instance . crack do |line |
230
235
vprint_status line . chomp
231
236
end
232
- results = check_results ( cracker_instance . each_cracked_password , results , format , 'Incremental' , cracker . cracker )
237
+ results = check_results ( cracker_instance . each_cracked_password , results , format , 'Incremental' )
233
238
vprint_good ( append_results ( tbl , results ) ) unless results . empty?
234
239
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
235
240
next if job [ 'cred_ids_left_to_crack' ] . empty?
@@ -239,7 +244,7 @@ def run
239
244
print_status "Cracking #{ format } hashes in wordlist mode..."
240
245
cracker_instance . mode_wordlist ( wordlist . path )
241
246
# Turn on KoreLogic rules if the user asked for it
242
- if cracker . cracker == 'john' && datastore [ 'KORELOGIC' ]
247
+ if @cracker_type == 'john' && datastore [ 'KORELOGIC' ]
243
248
cracker_instance . rules = 'KoreLogicRules'
244
249
print_status 'Applying KoreLogic ruleset...'
245
250
end
@@ -248,7 +253,7 @@ def run
248
253
vprint_status line . chomp
249
254
end
250
255
251
- results = check_results ( cracker_instance . each_cracked_password , results , format , 'Wordlist' , cracker . cracker )
256
+ results = check_results ( cracker_instance . each_cracked_password , results , format , 'Wordlist' )
252
257
vprint_good ( append_results ( tbl , results ) ) unless results . empty?
253
258
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
254
259
next if job [ 'cred_ids_left_to_crack' ] . empty?
0 commit comments