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

54 lines
1.6 KiB
Ruby
Raw Normal View History

2014-05-05 19:08:18 +01:00
# -*- coding:binary -*-
require 'spec_helper'
require 'rex/powershell'
2014-05-05 19:08:18 +01:00
describe Rex::Powershell::PshMethods do
2014-05-05 19:08:18 +01:00
describe "::download" do
it 'should return some powershell' do
script = Rex::Powershell::PshMethods.download('a','b')
2014-05-05 19:08:18 +01:00
script.should be
2014-08-25 18:13:38 -05:00
script.include?('WebClient').should be_truthy
2014-05-05 19:08:18 +01:00
end
end
describe "::uninstall" do
it 'should return some powershell' do
script = Rex::Powershell::PshMethods.uninstall('a')
2014-05-05 19:08:18 +01:00
script.should be
2014-08-25 18:13:38 -05:00
script.include?('Win32_Product').should be_truthy
2014-05-05 19:08:18 +01:00
end
end
describe "::secure_string" do
it 'should return some powershell' do
script = Rex::Powershell::PshMethods.secure_string('a')
2014-05-05 19:08:18 +01:00
script.should be
2014-08-25 18:13:38 -05:00
script.include?('AsPlainText').should be_truthy
2014-05-05 19:08:18 +01:00
end
end
2014-07-20 21:00:34 +01:00
describe "::who_locked_file" do
2014-05-05 19:08:18 +01:00
it 'should return some powershell' do
script = Rex::Powershell::PshMethods.who_locked_file('a')
2014-05-05 19:08:18 +01:00
script.should be
2014-08-25 18:13:38 -05:00
script.include?('Get-Process').should be_truthy
2014-05-05 19:08:18 +01:00
end
end
describe "::get_last_login" do
it 'should return some powershell' do
script = Rex::Powershell::PshMethods.get_last_login('a')
2014-05-05 19:08:18 +01:00
script.should be
2014-08-25 18:13:38 -05:00
script.include?('Get-QADComputer').should be_truthy
2014-05-05 19:08:18 +01:00
end
end
2015-09-23 20:45:51 +01:00
describe "::proxy_aware_download_and_exec_string" do
it 'should return some powershell' do
url = 'http://blah'
script = Rex::Powershell::PshMethods.proxy_aware_download_and_exec_string(url)
script.should be
script.include?(url).should be_truthy
script.downcase.include?('downloadstring').should be_truthy
end
end
2014-05-05 19:08:18 +01:00
end