2013-12-19 19:10:00 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-10-06 22:42:31 +02:00
|
|
|
load Metasploit::Framework.root.join('tools/password/cpassword_decrypt.rb').to_path
|
2013-12-19 19:10:00 +01:00
|
|
|
|
|
|
|
require 'msfenv'
|
|
|
|
require 'msf/base'
|
|
|
|
|
2015-10-16 22:57:04 +02:00
|
|
|
RSpec.describe CPassword do
|
2013-12-19 19:10:00 +01:00
|
|
|
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)
|
2015-10-20 21:37:18 +02:00
|
|
|
expect(pass).to eq('testpassword')
|
2013-12-19 19:10:00 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should return an empty string due to a bad password" do
|
|
|
|
# Invalid password format
|
|
|
|
cpass = "BadPassword"
|
|
|
|
pass = cpasswd.decrypt(cpass)
|
2015-10-20 21:37:18 +02:00
|
|
|
expect(pass).to eq('')
|
2013-12-19 19:10:00 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2014-08-26 22:24:08 +02:00
|
|
|
end
|