CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/spec/tools/cpassword_decrypt_spec.rb
Views: 11766
1
require 'spec_helper'
2
3
load Metasploit::Framework.root.join('tools/password/cpassword_decrypt.rb').to_path
4
5
require 'msfenv'
6
7
RSpec.describe CPassword do
8
context "Class methods" do
9
let(:cpasswd) do
10
CPassword.new
11
end
12
13
context ".decrypt" do
14
it "should return the decrypted password as 'testpassword'" do
15
# Encrypted password for "testpassword"
16
cpass = "AzVJmXh/J9KrU5n0czX1uBPLSUjzFE8j7dOltPD8tLk"
17
pass = cpasswd.decrypt(cpass)
18
expect(pass).to eq('testpassword')
19
end
20
21
it "should return an empty string due to a bad password" do
22
# Invalid password format
23
cpass = "BadPassword"
24
pass = cpasswd.decrypt(cpass)
25
expect(pass).to eq('')
26
end
27
end
28
end
29
end
30
31