Land #7900, missed userpass_file on CredentialCollection.empty?
commit
6522c0df2e
|
@ -207,8 +207,8 @@ class Metasploit::Framework::CredentialCollection
|
||||||
|
|
||||||
# Returns true when #each will have no results to iterate
|
# Returns true when #each will have no results to iterate
|
||||||
def empty?
|
def empty?
|
||||||
hasUser = username.present? || user_file.present? || !additional_publics.empty?
|
hasUser = username.present? || user_file.present? || userpass_file.present? || !additional_publics.empty?
|
||||||
hasPass = password.present? || pass_file.present? || !additional_privates.empty? || blank_passwords
|
hasPass = password.present? || pass_file.present? || userpass_file.present? ||!additional_privates.empty? || blank_passwords
|
||||||
prepended_creds.empty? && !hasUser || (hasUser && !hasPass)
|
prepended_creds.empty? && !hasUser || (hasUser && !hasPass)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,15 @@ RSpec.describe Metasploit::Framework::CredentialCollection do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#empty?" do
|
describe "#empty?" do
|
||||||
|
context "when only :userpass_file is set" do
|
||||||
|
let(:username) { nil }
|
||||||
|
let(:password) { nil }
|
||||||
|
let(:userpass_file) { "test_file" }
|
||||||
|
specify do
|
||||||
|
expect(collection.empty?).to eq false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "when :username is set" do
|
context "when :username is set" do
|
||||||
context "and :password is set" do
|
context "and :password is set" do
|
||||||
specify do
|
specify do
|
||||||
|
|
Loading…
Reference in New Issue