fix for bug 8456

On systems without bundled johntheripper (either by removing the bundled version or by no compatible version shipped) the system john is used.  In this case, all of the checking for compatible bundled jtr makes no sense and as such we can shortcut out of this to not only reduce the size of msf (for embedded) but also to speed execution (saving multiple calls to some random bundled binary cpuinfo*.bin).

This patch makes it very easy to simply remove cpuinfo and msf will not try to run it when missing and default to running john from the path.
bug/bundler_fix
ZeroChaos 2013-10-04 15:58:47 -04:00
parent 299dfe73f1
commit 5f4e4de267
1 changed files with 33 additions and 31 deletions

View File

@ -41,38 +41,40 @@ module Auxiliary::JohnTheRipper
cpuinfo_base = ::File.join(Msf::Config.install_root, "data", "cpuinfo") cpuinfo_base = ::File.join(Msf::Config.install_root, "data", "cpuinfo")
return @run_path if @run_path return @run_path if @run_path
case ::RUBY_PLATFORM if File.directory?(cpuinfo_base)
when /mingw|cygwin|mswin/ case ::RUBY_PLATFORM
data = `"#{cpuinfo_base}/cpuinfo.exe"` rescue nil when /mingw|cygwin|mswin/
case data data = `"#{cpuinfo_base}/cpuinfo.exe"` rescue nil
when /sse2/ case data
@run_path ||= "run.win32.sse2/john.exe" when /sse2/
when /mmx/ @run_path ||= "run.win32.sse2/john.exe"
@run_path ||= "run.win32.mmx/john.exe" when /mmx/
else @run_path ||= "run.win32.mmx/john.exe"
@run_path ||= "run.win32.any/john.exe" else
end @run_path ||= "run.win32.any/john.exe"
end
when /x86_64-linux/ when /x86_64-linux/
::FileUtils.chmod(0755, "#{cpuinfo_base}/cpuinfo.ia64.bin") rescue nil ::FileUtils.chmod(0755, "#{cpuinfo_base}/cpuinfo.ia64.bin") rescue nil
data = `#{cpuinfo_base}/cpuinfo.ia64.bin` rescue nil data = `#{cpuinfo_base}/cpuinfo.ia64.bin` rescue nil
case data case data
when /mmx/ when /mmx/
@run_path ||= "run.linux.x64.mmx/john" @run_path ||= "run.linux.x64.mmx/john"
else else
@run_path ||= "run.linux.x86.any/john" @run_path ||= "run.linux.x86.any/john"
end end
when /i[\d]86-linux/ when /i[\d]86-linux/
::FileUtils.chmod(0755, "#{cpuinfo_base}/cpuinfo.ia32.bin") rescue nil ::FileUtils.chmod(0755, "#{cpuinfo_base}/cpuinfo.ia32.bin") rescue nil
data = `#{cpuinfo_base}/cpuinfo.ia32.bin` rescue nil data = `#{cpuinfo_base}/cpuinfo.ia32.bin` rescue nil
case data case data
when /sse2/ when /sse2/
@run_path ||= "run.linux.x86.sse2/john" @run_path ||= "run.linux.x86.sse2/john"
when /mmx/ when /mmx/
@run_path ||= "run.linux.x86.mmx/john" @run_path ||= "run.linux.x86.mmx/john"
else else
@run_path ||= "run.linux.x86.any/john" @run_path ||= "run.linux.x86.any/john"
end
end end
end end
@run_path @run_path