Skip to content

Commit ef748fd

Browse files
David MaloneyDavid Maloney
authored andcommitted
check if database is connected first
wooops
1 parent 09e6c2f commit ef748fd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/msf/core/auxiliary/auth_brute.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def setup
5555
# @param [Metasploit::Framework::CredentialCollection] the credential collection to add to
5656
# @return [Metasploit::Framework::CredentialCollection] the modified Credentialcollection
5757
def prepend_db_hashes(cred_collection)
58-
if datastore['DB_ALL_CREDS']
58+
if datastore['DB_ALL_CREDS'] && framework.db.active
5959
creds = Metasploit::Credential::Core.joins(:private).where(metasploit_credential_privates: { type: 'Metasploit::Credential::NTLMHash' }, workspace_id: myworkspace.id)
6060
creds.each do |cred|
6161
cred_collection.prepend_cred(cred.to_credential)
@@ -70,7 +70,7 @@ def prepend_db_hashes(cred_collection)
7070
# @param [Metasploit::Framework::CredentialCollection] the credential collection to add to
7171
# @return [Metasploit::Framework::CredentialCollection] the modified Credentialcollection
7272
def prepend_db_keys(cred_collection)
73-
if datastore['DB_ALL_CREDS']
73+
if datastore['DB_ALL_CREDS'] && framework.db.active
7474
creds = Metasploit::Credential::Core.joins(:private).where(metasploit_credential_privates: { type: 'Metasploit::Credential::SSHKey' }, workspace_id: myworkspace.id)
7575
creds.each do |cred|
7676
cred_collection.prepend_cred(cred.to_credential)
@@ -85,7 +85,7 @@ def prepend_db_keys(cred_collection)
8585
# @param [Metasploit::Framework::CredentialCollection] the credential collection to add to
8686
# @return [Metasploit::Framework::CredentialCollection] the modified Credentialcollection
8787
def prepend_db_passwords(cred_collection)
88-
if datastore['DB_ALL_CREDS']
88+
if datastore['DB_ALL_CREDS'] && framework.db.active
8989
creds = Metasploit::Credential::Core.joins(:private).where(metasploit_credential_privates: { type: 'Metasploit::Credential::Password' }, workspace_id: myworkspace.id)
9090
creds.each do |cred|
9191
cred_collection.prepend_cred(cred.to_credential)

0 commit comments

Comments
 (0)