more minor cleanup

cleanup from code review
bug/bundler_fix
David Maloney 2014-06-18 11:24:55 -05:00
parent 9f11170c3b
commit 4b4d9796c5
No known key found for this signature in database
GPG Key ID: DEDBA9DC3A913DB2
2 changed files with 14 additions and 14 deletions

View File

@ -2,7 +2,7 @@ module Metasploit
module Framework module Framework
# This is a ActiveModel custom validator that assumes the attribute # This is a ActiveModel custom validator that assumes the attribute
# is supposed to be the path to a regular file. It checks whether the # is supposed to be the path to a regular file. It checks whether the
# file exists and whether or not it is a regular file. # file exists and whether or not it is an executable file.
class ExecutablePathValidator < ActiveModel::EachValidator class ExecutablePathValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value) def validate_each(record, attribute, value)

View File

@ -74,7 +74,7 @@ module Metasploit
# @return [String] the path to the selected JtR binary # @return [String] the path to the selected JtR binary
def binary_path def binary_path
# Always prefer a manually entered path # Always prefer a manually entered path
if john_path and ::File.file? john_path if john_path && ::File.file? john_path
bin_path = john_path bin_path = john_path
else else
# Look in the Environment PATH for the john binary # Look in the Environment PATH for the john binary
@ -146,6 +146,18 @@ module Metasploit
cmd << hash_path cmd << hash_path
end end
# This runs the show command in john and yields cracked passwords.
#
# @yield [String] the output lines from the command
# @return [void]
def each_cracked_password
::IO.popen(show_command, "rb") do |fd|
fd.each_line do |line|
yield line
end
end
end
# This method returns the path to a default john.pot file. # This method returns the path to a default john.pot file.
# #
# @return [String] the path to the default john.pot file # @return [String] the path to the default john.pot file
@ -178,18 +190,6 @@ module Metasploit
cmd << hash_path cmd << hash_path
end end
# This runs the show command in john to show cracked passwords.
#
# @yield [String] the output lines from the command
# @return [void]
def show_passwords
::IO.popen(show_command, "rb") do |fd|
fd.each_line do |line|
yield line
end
end
end
private private
# This method tries to identify the correct version of the pre-shipped # This method tries to identify the correct version of the pre-shipped