Files
metasploit-gs/spec/lib/rex/exploitation/powershell/script_spec.rb
T

49 lines
1.3 KiB
Ruby
Raw Normal View History

2014-05-05 19:01:36 +01:00
# -*- coding:binary -*-
require 'spec_helper'
require 'rex/exploitation/powershell'
describe Rex::Exploitation::Powershell::Output do
let(:example_script) do
Rex::Text.rand_text_alpha(400)
end
let(:subject) do
Rex::Exploitation::Powershell::Script.new(example_script)
end
describe "::initialize" do
it 'should create a new script object' do
subject.should be
subject.should be_kind_of Rex::Exploitation::Powershell::Script
subject.rig.should be
subject.rig.should be_kind_of Rex::RandomIdentifierGenerator
subject.code.should be
subject.code.should be_kind_of String
2014-08-25 17:50:38 -05:00
subject.code.empty?.should be_falsey
subject.functions.empty?.should be_truthy
2014-05-05 19:01:36 +01:00
end
end
describe "::to_byte_array" do
it 'should generate a powershell byte array' do
byte_array = Rex::Exploitation::Powershell::Script.to_byte_array("parp")
byte_array.should be
byte_array.should be_kind_of String
2014-08-25 18:13:38 -05:00
byte_array.include?('[Byte[]] $').should be_truthy
2014-05-05 19:01:36 +01:00
end
end
describe "::code_modifiers" do
it 'should return an array of modifier methods' do
mods = Rex::Exploitation::Powershell::Script.code_modifiers
mods.should be
mods.should be_kind_of Array
2014-08-25 17:50:38 -05:00
mods.empty?.should be_falsey
2014-05-05 19:01:36 +01:00
end
end
end