Skip to content

Commit 093f488

Browse files
David MaloneyDavid Maloney
authored andcommitted
add db_all_cred methods to authbrute
adds 3 methods to add db_all_creds functionality back to the loginscanners
1 parent 185ce36 commit 093f488

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

lib/msf/core/auxiliary/auth_brute.rb

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,53 @@ def setup
4949
@@max_per_service = nil
5050
end
5151

52+
# This method takes a {Metasploit::Framework::CredentialCollection} and prepends existing NTLMHashes
53+
# from the database. This allows the users to use the DB_ALL_CREDS option.
54+
#
55+
# @param [Metasploit::Framework::CredentialCollection] the credential collection to add to
56+
# @return [Metasploit::Framework::CredentialCollection] the modified Credentialcollection
57+
def prepend_db_hashes(cred_collection)
58+
if datastore['DB_ALL_CREDS']
59+
creds = Metasploit::Credential::Core.joins(:private).where(metasploit_credential_privates: { type: 'Metasploit::Credential::NTLMHash' }, workspace_id: myworkspace.id)
60+
creds.each do |cred|
61+
cred_collection.prepend_cred(cred.to_credential)
62+
end
63+
end
64+
cred_collection
65+
end
66+
67+
# This method takes a {Metasploit::Framework::CredentialCollection} and prepends existing SSHKeys
68+
# from the database. This allows the users to use the DB_ALL_CREDS option.
69+
#
70+
# @param [Metasploit::Framework::CredentialCollection] the credential collection to add to
71+
# @return [Metasploit::Framework::CredentialCollection] the modified Credentialcollection
72+
def prepend_db_keys(cred_collection)
73+
if datastore['DB_ALL_CREDS']
74+
creds = Metasploit::Credential::Core.joins(:private).where(metasploit_credential_privates: { type: 'Metasploit::Credential::SSHKey' }, workspace_id: myworkspace.id)
75+
creds.each do |cred|
76+
cred_collection.prepend_cred(cred.to_credential)
77+
end
78+
end
79+
cred_collection
80+
end
81+
82+
# This method takes a {Metasploit::Framework::CredentialCollection} and prepends existing Password Credentials
83+
# from the database. This allows the users to use the DB_ALL_CREDS option.
84+
#
85+
# @param [Metasploit::Framework::CredentialCollection] the credential collection to add to
86+
# @return [Metasploit::Framework::CredentialCollection] the modified Credentialcollection
87+
def prepend_db_passwords(cred_collection)
88+
if datastore['DB_ALL_CREDS']
89+
creds = Metasploit::Credential::Core.joins(:private).where(metasploit_credential_privates: { type: 'Metasploit::Credential::Password' }, workspace_id: myworkspace.id)
90+
creds.each do |cred|
91+
cred_collection.prepend_cred(cred.to_credential)
92+
end
93+
end
94+
cred_collection
95+
end
96+
97+
98+
5299
# Checks all three files for usernames and passwords, and combines them into
53100
# one credential list to apply against the supplied block. The block (usually
54101
# something like do_login(user,pass) ) is responsible for actually recording

0 commit comments

Comments
 (0)