@@ -55,7 +55,7 @@ def setup
55
55
# @param [Metasploit::Framework::CredentialCollection] the credential collection to add to
56
56
# @return [Metasploit::Framework::CredentialCollection] the modified Credentialcollection
57
57
def prepend_db_hashes ( cred_collection )
58
- if datastore [ 'DB_ALL_CREDS' ]
58
+ if datastore [ 'DB_ALL_CREDS' ] && framework . db . active
59
59
creds = Metasploit ::Credential ::Core . joins ( :private ) . where ( metasploit_credential_privates : { type : 'Metasploit::Credential::NTLMHash' } , workspace_id : myworkspace . id )
60
60
creds . each do |cred |
61
61
cred_collection . prepend_cred ( cred . to_credential )
@@ -70,7 +70,7 @@ def prepend_db_hashes(cred_collection)
70
70
# @param [Metasploit::Framework::CredentialCollection] the credential collection to add to
71
71
# @return [Metasploit::Framework::CredentialCollection] the modified Credentialcollection
72
72
def prepend_db_keys ( cred_collection )
73
- if datastore [ 'DB_ALL_CREDS' ]
73
+ if datastore [ 'DB_ALL_CREDS' ] && framework . db . active
74
74
creds = Metasploit ::Credential ::Core . joins ( :private ) . where ( metasploit_credential_privates : { type : 'Metasploit::Credential::SSHKey' } , workspace_id : myworkspace . id )
75
75
creds . each do |cred |
76
76
cred_collection . prepend_cred ( cred . to_credential )
@@ -85,7 +85,7 @@ def prepend_db_keys(cred_collection)
85
85
# @param [Metasploit::Framework::CredentialCollection] the credential collection to add to
86
86
# @return [Metasploit::Framework::CredentialCollection] the modified Credentialcollection
87
87
def prepend_db_passwords ( cred_collection )
88
- if datastore [ 'DB_ALL_CREDS' ]
88
+ if datastore [ 'DB_ALL_CREDS' ] && framework . db . active
89
89
creds = Metasploit ::Credential ::Core . joins ( :private ) . where ( metasploit_credential_privates : { type : 'Metasploit::Credential::Password' } , workspace_id : myworkspace . id )
90
90
creds . each do |cred |
91
91
cred_collection . prepend_cred ( cred . to_credential )
0 commit comments