1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-10-29 18:07:27 +01:00
metasploit-framework/spec/tools/cpassword_decrypt_spec.rb
Luke Imhoff b863978028
Remove fastlib
MSP-11368
MSP-11143

Remove fastlib as it slows down the code loading process.  From the
previous commit, the mean loading for
`METASPLOIT_FRAMEWORK_PROFILE=true msfconsole -q -x exit` was
27.9530±0.3485 seconds (N=10).  The mean after removal of fastlib
was 17.9820±0.6497 seconds (N=10).  This means an average 35.67%
reduction in boot time.
2014-09-18 15:24:21 -05:00

31 lines
753 B
Ruby

require 'spec_helper'
load Metasploit::Framework.root.join('tools/cpassword_decrypt.rb').to_path
require 'msfenv'
require 'msf/base'
describe CPassword do
context "Class methods" do
let(:cpasswd) do
CPassword.new
end
context ".decrypt" do
it "should return the decrypted password as 'testpassword'" do
# Encrypted password for "testpassword"
cpass = "AzVJmXh/J9KrU5n0czX1uBPLSUjzFE8j7dOltPD8tLk"
pass = cpasswd.decrypt(cpass)
pass.should eq('testpassword')
end
it "should return an empty string due to a bad password" do
# Invalid password format
cpass = "BadPassword"
pass = cpasswd.decrypt(cpass)
pass.should eq('')
end
end
end
end