Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/spec/lib/msf/exploit/local_spec.rb
Views: 11704
require 'spec_helper'1require 'rex/post/meterpreter/extensions/stdapi/sys/config'23RSpec.describe Msf::Exploit::Local do4describe '#exploit_type' do5it 'indicates that the exploit is local' do6expect(subject.exploit_type).to eq 'local'7end8end910describe '#sysinfo' do11before(:each) do12allow(subject).to receive(:session).and_return(session)13end1415context 'when the session is nil' do16let(:session) { nil }1718it 'returns nil' do19expect(subject.sysinfo).to eq nil20end21end2223context 'when the session is not Meterpreter' do24let(:session) do25connection = nil26Msf::Sessions::CommandShell.new(connection)27end2829it 'returns nil' do30expect(subject.sysinfo).to eq nil31end32end3334context 'when the session is Meterpreter' do35let(:session) do36connection = nil37session = Msf::Sessions::Meterpreter_x86_Win.new(connection)38session.register_extension_alias(39'sys',40Rex::Post::Meterpreter::ObjectAliases.new(41'config' => instance_double(42::Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Config,43sysinfo: { 'Computer' => 'FooComputer' }44)45)46)47session48end4950it 'returns the sysinfo object' do51expect(subject.sysinfo).to eq({ 'Computer' => 'FooComputer' })52end53end54end55end565758