Skip to content

Commit 1410477

Browse files
author
Tod Beardsley
committed
Use the blank password/username variables
1 parent 2294ea0 commit 1410477

File tree

1 file changed

+23
-1
lines changed
  • spec/lib/msf/ui/console/command_dispatcher

1 file changed

+23
-1
lines changed

spec/lib/msf/ui/console/command_dispatcher/db_spec.rb

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@
9292
public: blank_pub,
9393
realm: nil,
9494
workspace: framework.db.workspace)
95+
nonblank_pub = FactoryGirl.create(:metasploit_credential_username, username: nonblank_username)
96+
blank_priv = FactoryGirl.create(:metasploit_credential_password, data: blank_password)
97+
core = FactoryGirl.create(:metasploit_credential_core,
98+
origin: FactoryGirl.create(:metasploit_credential_origin_import),
99+
private: blank_priv,
100+
public: nonblank_pub,
101+
realm: nil,
102+
workspace: framework.db.workspace)
95103
end
96104
context "when the credential is present" do
97105
it "should show a user that matches the given expression" do
@@ -107,7 +115,7 @@
107115
end
108116
context "and when the username is blank" do
109117
it "should show a user that matches the given expression" do
110-
db.cmd_creds("-u", "")
118+
db.cmd_creds("-u", blank_username )
111119
@output.should =~ [
112120
"Credentials",
113121
"===========",
@@ -118,6 +126,19 @@
118126
]
119127
end
120128
end
129+
context "and when the password is blank" do
130+
it "should show a user that matches the given expression" do
131+
db.cmd_creds("-P", blank_password )
132+
@output.should =~ [
133+
"Credentials",
134+
"===========",
135+
"",
136+
"host service public private realm private_type",
137+
"---- ------- ------ ------- ----- ------------",
138+
" nonblank_user Password"
139+
]
140+
end
141+
end
121142
end
122143
context "when the credential is absent" do
123144
it "should return a blank set" do
@@ -132,6 +153,7 @@
132153
end
133154
end
134155
end
156+
135157
describe "add-password" do
136158
let(:username) { "username" }
137159
let(:password) { "password" }

0 commit comments

Comments
 (0)