lib/metasploit/credential/importer/pwdump.rb in metasploit-credential-1.0.0.pre.rails.pre.4.0 vs lib/metasploit/credential/importer/pwdump.rb in metasploit-credential-1.0.0
- old
+ new
@@ -1,10 +1,10 @@
# Implements importation behavior for pwdump files exported by Metasploit as well as files from the John the Ripper
# hash cracking suite: http://www.openwall.com/john/
#
-# Please note that in the case of data exported from Metasploit, the dataset will contain information on the {Mdm::Host}
-# and {Mdm::Service} objects that are related to the credential. This means that Metasploit exports will be limited to
+# Please note that in the case of data exported from Metasploit, the dataset will contain information on the `Mdm::Host`
+# and `Mdm::Service` objects that are related to the credential. This means that Metasploit exports will be limited to
# containing {Metasploit::Credential::Login} objects, which is the legacy behavior of this export prior to the creation
# of this library.
class Metasploit::Credential::Importer::Pwdump
include Metasploit::Credential::Importer::Base
include Metasploit::Credential::Creation
@@ -23,13 +23,14 @@
NONREPLAYABLE_REGEX = /^[\s]*([\x21-\x7f]+):([\x21-\x7f]+):::/n
# Matches lines that contain usernames and plaintext passwords
PLAINTEXT_REGEX = /^[\s]*([\x21-\x7f]+)[\s]+([\x21-\x7f]+)?/n
+ # Matches lines taht contain MD5 hashes for PostgreSQL
POSTGRES_REGEX = /^[\s]*([\x21-\x7f]+):md5([0-9a-f]{32})$/
- # Matches a line that we use to get information for creating {Mdm::Host} and {Mdm::Service} objects
+ # Matches a line that we use to get information for creating `Mdm::Host` and `Mdm::Service` objects
# TODO: change to use named groups from 1.9+
SERVICE_COMMENT_REGEX = /^#[\s]*([0-9.]+):([0-9]+)(\x2f(tcp|udp))?[\s]*(\x28([^\x29]*)\x29)?/n
# Matches the way that John the Ripper exports SMB hashes with no password piece
SMB_WITH_JTR_BLANK_PASSWORD_REGEX = /^[\s]*([^\s:]+):([0-9]+):NO PASSWORD\*+:NO PASSWORD\*+[^\s]*$/
@@ -68,11 +69,11 @@
check_string
end
end
end
- # Perform the import of the credential data, creating {Mdm::Host} and {Mdm::Service} objects as needed,
+ # Perform the import of the credential data, creating `Mdm::Host` and `Mdm::Service` objects as needed,
# parsing out data by matching against regex constants that match the various kinds of valid lines found
# in the file. Ignore lines which match none of the REGEX constants.
# @return [void]
def import!
service_info = nil
@@ -157,10 +158,10 @@
results
end
# Take an msfpwdump comment string and parse it into information necessary for
- # creating {Mdm::Host} and {Mdm::Service} objects.
+ # creating `Mdm::Host` and `Mdm::Service` objects.
# @param comment_string [String] a string starting with a '#' that conforms to {SERVICE_COMMENT_REGEX}
# @return [Hash]
def service_info_from_comment_string(comment_string)
service_info = {}
if comment_string[SERVICE_COMMENT_REGEX]