@@ -119,6 +119,8 @@ def crack_command
119
119
120
120
if config . present?
121
121
cmd << ( "--config=" + config )
122
+ else
123
+ cmd << ( "--config=" + john_config_file )
122
124
end
123
125
124
126
if pot . present?
@@ -162,6 +164,13 @@ def each_cracked_password
162
164
end
163
165
end
164
166
167
+ # This method returns the path to a default john.conf file.
168
+ #
169
+ # @return [String] the path to the default john.conf file
170
+ def john_config_file
171
+ ::File . join ( ::Msf ::Config . data_directory , "john" , "confs" , "john.conf" )
172
+ end
173
+
165
174
# This method returns the path to a default john.pot file.
166
175
#
167
176
# @return [String] the path to the default john.pot file
@@ -189,6 +198,8 @@ def show_command
189
198
190
199
if config
191
200
cmd << "--config=#{ config } "
201
+ else
202
+ cmd << ( "--config=" + john_config_file )
192
203
end
193
204
194
205
cmd << hash_path
@@ -199,11 +210,11 @@ def show_command
199
210
# This method tries to identify the correct version of the pre-shipped
200
211
# JtR binaries to use based on the platform.
201
212
#
202
- # @return [NilClass] if the correct bianry could not be determined
213
+ # @return [NilClass] if the correct binary could not be determined
203
214
# @return [String] the path to the selected binary
204
215
def select_shipped_binary
205
216
cpuinfo_base = ::File . join ( Msf ::Config . data_directory , "cpuinfo" )
206
- runpath = nil
217
+ run_path = nil
207
218
if File . directory? ( cpuinfo_base )
208
219
data = nil
209
220
@@ -215,11 +226,11 @@ def select_shipped_binary
215
226
end
216
227
case data
217
228
when /sse2/
218
- run_path ||= " run.win32.sse2/ john.exe"
229
+ run_path ||= :: File . join ( Msf :: Config . data_directory , "john" , " run.win32.sse2" , " john.exe")
219
230
when /mmx/
220
- run_path ||= " run.win32.mmx/ john.exe"
231
+ run_path ||= :: File . join ( Msf :: Config . data_directory , "john" , " run.win32.mmx" , " john.exe")
221
232
else
222
- run_path ||= " run.win32.any/ john.exe"
233
+ run_path ||= :: File . join ( Msf :: Config . data_directory , "john" , " run.win32.any" , " john.exe")
223
234
end
224
235
when /x86_64-linux/
225
236
fname = "#{ cpuinfo_base } /cpuinfo.ia64.bin"
@@ -229,9 +240,9 @@ def select_shipped_binary
229
240
end
230
241
case data
231
242
when /mmx/
232
- run_path ||= " run.linux.x64.mmx/ john"
243
+ run_path ||= :: File . join ( Msf :: Config . data_directory , "john" , " run.linux.x64.mmx" , " john")
233
244
else
234
- run_path ||= " run.linux.x86.any/ john"
245
+ run_path ||= :: File . join ( Msf :: Config . data_directory , "john" , " run.linux.x86.any" , " john")
235
246
end
236
247
when /i[\d ]86-linux/
237
248
fname = "#{ cpuinfo_base } /cpuinfo.ia32.bin"
@@ -241,15 +252,15 @@ def select_shipped_binary
241
252
end
242
253
case data
243
254
when /sse2/
244
- run_path ||= " run.linux.x86.sse2/ john"
255
+ run_path ||= :: File . join ( Msf :: Config . data_directory , "john" , " run.linux.x86.sse2" , " john")
245
256
when /mmx/
246
- run_path ||= " run.linux.x86.mmx/ john"
257
+ run_path ||= :: File . join ( Msf :: Config . data_directory , "john" , " run.linux.x86.mmx" , " john")
247
258
else
248
- run_path ||= " run.linux.x86.any/ john"
259
+ run_path ||= :: File . join ( Msf :: Config . data_directory , "john" , " run.linux.x86.any" , " john")
249
260
end
250
261
end
251
262
end
252
- runpath
263
+ run_path
253
264
end
254
265
255
266
0 commit comments