|
92 | 92 | public: blank_pub,
|
93 | 93 | realm: nil,
|
94 | 94 | 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) |
95 | 103 | end
|
96 | 104 | context "when the credential is present" do
|
97 | 105 | it "should show a user that matches the given expression" do
|
|
107 | 115 | end
|
108 | 116 | context "and when the username is blank" do
|
109 | 117 | it "should show a user that matches the given expression" do
|
110 |
| - db.cmd_creds("-u", "") |
| 118 | + db.cmd_creds("-u", blank_username ) |
111 | 119 | @output.should =~ [
|
112 | 120 | "Credentials",
|
113 | 121 | "===========",
|
|
118 | 126 | ]
|
119 | 127 | end
|
120 | 128 | 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 |
121 | 142 | end
|
122 | 143 | context "when the credential is absent" do
|
123 | 144 | it "should return a blank set" do
|
|
132 | 153 | end
|
133 | 154 | end
|
134 | 155 | end
|
| 156 | + |
135 | 157 | describe "add-password" do
|
136 | 158 | let(:username) { "username" }
|
137 | 159 | let(:password) { "password" }
|
|
0 commit comments