/
githubmirror
/
metasploit-framework
Обзор
Документация
Войти
/
githubmirror
/
metasploit-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
spec/lib/msf/exploit/local_spec.rb
70 строк
2 KB
Christophe De La Fuente
Remove the `job_listener:` kwarg in `run_simple`, `exploit_simple` and `check_simple`
24 июл 2026, 20:24
Не верифицирован
24 июл 2026, 20:24
f2141a6
Код
Авторство
О чём код?
require 'spec_helper' require 'rex/post/meterpreter/extensions/stdapi/sys/config' RSpec.describe Msf::Exploit::Local do describe '#exploit_type' do it 'indicates that the exploit is local' do expect(subject.exploit_type).to eq 'local' end end describe '#sysinfo' do before(:each) do allow(subject).to receive(:session).and_return(session) end context 'when the session is nil' do let(:session) { nil } it 'returns nil' do expect(subject.sysinfo).to eq nil end end context 'when the session is not Meterpreter' do let(:session) do connection = nil Msf::Sessions::CommandShell.new(connection) end it 'returns nil' do expect(subject.sysinfo).to eq nil end end context 'when the session is Meterpreter' do let(:session) do connection = nil session = Msf::Sessions::Meterpreter_x86_Win.new(connection) session.register_extension_alias( 'sys', Rex::Post::Meterpreter::ObjectAliases.new( 'config' => instance_double( ::Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Config, sysinfo: { 'Computer' => 'FooComputer' } ) ) ) session end it 'returns the sysinfo object' do expect(subject.sysinfo).to eq({ 'Computer' => 'FooComputer' }) end end end describe '#run_simple' do it "forwards opts (including 'JobListener') to Msf::Simple::Exploit.exploit_simple" do listener = double('JobListener') opts = { 'SESSION' => 1, 'JobListener' => listener } expect(Msf::Simple::Exploit).to receive(:exploit_simple).with(subject, opts) subject.run_simple(opts) end it "does not require a 'JobListener' opts key" do expect(Msf::Simple::Exploit).to receive(:exploit_simple).with(subject, {}) subject.run_simple end end end