Use set_msf_data on connection_spec

This commit is contained in:
jvazquez-r7 2015-11-24 13:54:31 -06:00 committed by Brent Cook
parent 3d0fcdf84d
commit 046a73b3b3
1 changed files with 57 additions and 86 deletions

View File

@ -30,14 +30,8 @@ RSpec.describe Msf::Exploit::Remote::Java::Rmi::Client::Jmx::Connection do
let(:name_get) { 'DefaultDomain:type=MLet' }
#
# Callbacks
#
before(:each) do
def msf_io.put(_data)
seek(0)
write(
it "returns true" do
msf_io.set_msf_data(
"\x51\xac\xed\x00\x05\x77\x0f\x01\x1e\xc8\x7c\x01\x00\x00\x01\x4c" +
"\x4e\x3d\x1c\x2f\x80\x08\x73\x72\x00\x1f\x6a\x61\x76\x61\x78\x2e" +
"\x6d\x61\x6e\x61\x67\x65\x6d\x65\x6e\x74\x2e\x4f\x62\x6a\x65\x63" +
@ -55,11 +49,6 @@ RSpec.describe Msf::Exploit::Remote::Java::Rmi::Client::Jmx::Connection do
"\x65\x66\x61\x75\x6c\x74\x44\x6f\x6d\x61\x69\x6e\x3a\x74\x79\x70" +
"\x65\x3d\x4d\x4c\x65\x74\x78"
)
seek(0)
end
end
it "returns true" do
expect(mod.send_jmx_get_object_instance(sock: msf_io, name: name_get)).to be_truthy
end
end
@ -69,10 +58,8 @@ RSpec.describe Msf::Exploit::Remote::Java::Rmi::Client::Jmx::Connection do
context "when the object is created successfully" do
include_context "Msf::StringIO"
before(:each) do
def msf_io.put(_data)
seek(0)
write(
it "returns true" do
msf_io.set_msf_data(
"\x51\xac\xed\x00\x05\x77\x0f\x01\x1e\xc8\x7c\x01\x00\x00\x01\x4c" +
"\x4e\x3d\x1c\x2f\x80\x07\x73\x72\x00\x1f\x6a\x61\x76\x61\x78\x2e" +
"\x6d\x61\x6e\x61\x67\x65\x6d\x65\x6e\x74\x2e\x4f\x62\x6a\x65\x63" +
@ -90,11 +77,6 @@ RSpec.describe Msf::Exploit::Remote::Java::Rmi::Client::Jmx::Connection do
"\x65\x66\x61\x75\x6c\x74\x44\x6f\x6d\x61\x69\x6e\x3a\x74\x79\x70" +
"\x65\x3d\x4d\x4c\x65\x74\x78"
)
seek(0)
end
end
it "returns true" do
expect(mod.send_jmx_create_mbean(sock: msf_io, name: name_create)).to be_truthy
end
end
@ -116,14 +98,8 @@ RSpec.describe Msf::Exploit::Remote::Java::Rmi::Client::Jmx::Connection do
}
end
#
# Callbacks
#
before(:each) do
def msf_io.put(_data)
seek(0)
write(
it "returns true" do
msf_io.set_msf_data(
"\x51\xac\xed\x00\x05\x77\x0f\x01\x1e\xc8\x7c\x01\x00\x00\x01\x4c" +
"\x4e\x3d\x1c\x2f\x80\x09\x73\x72\x00\x11\x6a\x61\x76\x61\x2e\x75" +
"\x74\x69\x6c\x2e\x48\x61\x73\x68\x53\x65\x74\xba\x44\x85\x95\x96" +
@ -144,11 +120,6 @@ RSpec.describe Msf::Exploit::Remote::Java::Rmi::Client::Jmx::Connection do
"\x6f\x6f\x6d\x79\x3a\x6e\x61\x6d\x65\x3d\x6a\x6d\x78\x70\x61\x79" +
"\x6c\x6f\x61\x64\x2c\x69\x64\x3d\x31\x78\x78"
)
seek(0)
end
end
it "returns true" do
expect(mod.send_jmx_invoke(invoke_args.merge(sock: msf_io))).to be_truthy
end
end