Basic specs

bug/bundler_fix
Meatballs 2014-04-25 18:14:39 +01:00
parent 8031e50d35
commit 3ae8c3ff46
No known key found for this signature in database
GPG Key ID: 5380EAF01F2F8B38
1 changed files with 32 additions and 1 deletions

View File

@ -5,12 +5,43 @@ require 'rex/exploitation/powershell'
describe Rex::Exploitation::Powershell do
let(:example_script) do
"""function DumpHashes
{
LoadApi
$bootkey = Get-BootKey;
$hbootKey = Get-HBootKey $bootkey;
Get-UserKeys | %{
$hashes = Get-UserHashes $_ $hBootKey;
\"{0}:{1}:{2}:{3}:::\" -f ($_.UserName,$_.Rid,
[BitConverter]::ToString($hashes[0]).Replace(\"-\",\"\").ToLower(),
[BitConverter]::ToString($hashes[1]).Replace(\"-\",\"\").ToLower());
}
}
DumpHashes"""
end
describe "::read_script" do
it 'should create a script from a string input' do
script = described_class.read_script("parp")
script = described_class.read_script(example_script)
script.should be_a_kind_of Rex::Exploitation::Powershell::Script
end
end
describe "::process_subs" do
it 'should create an array of substitutions to process' do
subs = described_class.process_subs("BitConverter,ParpConverter;$bootkey,$parpkey;")
subs.should eq [['BitConverter','ParpConverter'],['$bootkey','$parpkey']]
end
end
describe "::make_subs" do
it 'should substitute values in script' do
script = described_class.make_subs(example_script,[['BitConverter','ParpConverter']])
script.include?('BitConverter').should be_false
script.include?('ParpConverter').should be_true
end
end
end