@@ -25,9 +25,8 @@ def initialize
25
25
'Actions' => [
26
26
[ 'john' , { 'Description' => 'Use John the Ripper' } ] ,
27
27
[ 'hashcat' , { 'Description' => 'Use Hashcat' } ] ,
28
- [ 'auto' , { 'Description' => 'Use either John the Ripper or Hashcat, if both are present, use Hashcat' } ]
29
28
] ,
30
- 'DefaultAction' => 'auto ' ,
29
+ 'DefaultAction' => 'john ' ,
31
30
'Notes' => {
32
31
'Stability' => [ CRASH_SAFE ] ,
33
32
'SideEffects' => [ ] ,
@@ -45,21 +44,16 @@ def initialize
45
44
46
45
def show_command ( cracker_instance )
47
46
return unless datastore [ 'ShowCommand' ]
48
-
49
- newaction = getaction ( )
50
47
51
- if newaction == 'john'
48
+ if action . name == 'john'
52
49
cmd = cracker_instance . john_crack_command
53
- elsif newaction == 'hashcat'
50
+ elsif action . name == 'hashcat'
54
51
cmd = cracker_instance . hashcat_crack_command
55
52
end
56
53
print_status ( " Cracking Command: #{ cmd . join ( ' ' ) } " )
57
54
end
58
55
59
56
def check_results ( passwords , results , hash_type , method )
60
-
61
- newaction = getaction ( )
62
-
63
57
passwords . each do |password_line |
64
58
password_line . chomp!
65
59
next if password_line . blank?
@@ -69,12 +63,12 @@ def check_results(passwords, results, hash_type, method)
69
63
next unless fields . count >= 3
70
64
71
65
cred = { 'hash_type' => hash_type , 'method' => method }
72
- if newaction == 'john'
66
+ if action . name == 'john'
73
67
cred [ 'username' ] = fields . shift
74
68
cred [ 'core_id' ] = fields . pop
75
69
4 . times { fields . pop } # Get rid of extra :
76
70
cred [ 'password' ] = fields . join ( ':' ) # Anything left must be the password. This accounts for passwords with semi-colons in it
77
- elsif newaction == 'hashcat'
71
+ elsif action . name == 'hashcat'
78
72
cred [ 'core_id' ] = fields . shift
79
73
cred [ 'hash' ] = fields . shift
80
74
cred [ 'password' ] = fields . join ( ':' ) # Anything left must be the password. This accounts for passwords with semi-colons in it
@@ -91,17 +85,14 @@ def check_results(passwords, results, hash_type, method)
91
85
end
92
86
93
87
def run
94
-
95
- newaction = getaction ( )
96
-
97
88
tbl = tbl = cracker_results_table
98
89
99
90
hash_types_to_crack = [ 'descrypt' ]
100
91
jobs_to_do = [ ]
101
92
102
93
# build our job list
103
94
hash_types_to_crack . each do |hash_type |
104
- job = hash_job ( hash_type , newaction )
95
+ job = hash_job ( hash_type , action . name )
105
96
if job . nil?
106
97
print_status ( "No #{ hash_type } found to crack" )
107
98
else
@@ -119,7 +110,7 @@ def run
119
110
# Inner array format: db_id, hash_type, username, password, method_of_crack
120
111
results = [ ]
121
112
122
- cracker = new_password_cracker ( newaction )
113
+ cracker = new_password_cracker ( action . name )
123
114
124
115
# generate our wordlist and close the file handle. max length of DES is 8
125
116
wordlist = wordlist_file ( 8 )
@@ -145,7 +136,7 @@ def run
145
136
cracker_instance = cracker . dup
146
137
cracker_instance . format = format
147
138
148
- if newaction == 'john'
139
+ if action . name == 'john'
149
140
cracker_instance . fork = datastore [ 'FORK' ]
150
141
end
151
142
@@ -156,7 +147,7 @@ def run
156
147
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
157
148
next if job [ 'cred_ids_left_to_crack' ] . empty?
158
149
159
- if newaction == 'john'
150
+ if action . name == 'john'
160
151
print_status "Cracking #{ format } hashes in single mode..."
161
152
cracker_instance . mode_single ( wordlist . path )
162
153
show_command cracker_instance
@@ -198,7 +189,7 @@ def run
198
189
print_status "Cracking #{ format } hashes in wordlist mode..."
199
190
cracker_instance . mode_wordlist ( wordlist . path )
200
191
# Turn on KoreLogic rules if the user asked for it
201
- if newaction == 'john' && datastore [ 'KORELOGIC' ]
192
+ if action . name == 'john' && datastore [ 'KORELOGIC' ]
202
193
cracker_instance . rules = 'KoreLogicRules'
203
194
print_status 'Applying KoreLogic ruleset...'
204
195
end
@@ -222,24 +213,4 @@ def run
222
213
end
223
214
end
224
215
end
225
-
226
- def getaction
227
- newaction = action . name
228
- if action . name == 'auto'
229
- path = Rex ::FileUtils . find_full_path ( 'hashcat' ) ||
230
- Rex ::FileUtils . find_full_path ( 'hashcat.exe' )
231
- if path
232
- newaction = 'hashcat'
233
- else
234
- path = Rex ::FileUtils . find_full_path ( 'john' ) ||
235
- Rex ::FileUtils . find_full_path ( 'john.exe' )
236
- if path
237
- newaction = 'john'
238
- else
239
- raise PasswordCrackerNotFoundError , 'No suitable john/hashcat binary was found on the system'
240
- end
241
- end
242
- end
243
- return newaction
244
- end
245
216
end
0 commit comments