Create Msf::Jmx::Util
parent
d9c6c56779
commit
c516190d07
|
@ -1,74 +1,17 @@
|
|||
# -*- coding: binary -*-
|
||||
|
||||
require 'rex/java/serialization'
|
||||
|
||||
module Msf
|
||||
module Jmx
|
||||
require 'msf/jmx/util'
|
||||
require 'msf/jmx/discovery'
|
||||
require 'msf/jmx/handshake'
|
||||
require 'msf/jmx/mbean'
|
||||
|
||||
include Msf::Jmx::Util
|
||||
include Msf::Jmx::Discovery
|
||||
include Msf::Jmx::Handshake
|
||||
include Msf::Jmx::MBean
|
||||
|
||||
def get_instance_answer(stream)
|
||||
new_object = nil
|
||||
|
||||
if stream.contents[1]
|
||||
new_object = stream.contents[1]
|
||||
else
|
||||
print_error("#{peer} - getObjectInstance returned an incorrect answer")
|
||||
return nil
|
||||
end
|
||||
|
||||
unless new_object.class == Rex::Java::Serialization::Model::NewObject
|
||||
print_error("#{peer} - getObjectInstance didn't return a new object")
|
||||
return nil
|
||||
end
|
||||
|
||||
new_object.class_desc.description.class_name.contents
|
||||
end
|
||||
|
||||
def get_mbean_from_url_answer(stream)
|
||||
new_object = nil
|
||||
|
||||
if stream.contents[3]
|
||||
new_object = stream.contents[3]
|
||||
else
|
||||
print_error("#{peer} - getMBeansFromURL returned an incorrect answer")
|
||||
return nil
|
||||
end
|
||||
|
||||
unless new_object.class == Rex::Java::Serialization::Model::NewObject
|
||||
print_error("#{peer} - getMBeansFromURL didn't return a new object")
|
||||
return nil
|
||||
end
|
||||
|
||||
new_object.class_desc.description.class_name.contents
|
||||
end
|
||||
|
||||
def extract_string(io)
|
||||
raw_length = io.read(2)
|
||||
unless raw_length && raw_length.length == 2
|
||||
return nil
|
||||
end
|
||||
length = raw_length.unpack('n')[0]
|
||||
|
||||
string = io.read(length)
|
||||
unless string && string.length == length
|
||||
return nil
|
||||
end
|
||||
|
||||
string
|
||||
end
|
||||
|
||||
def extract_int(io)
|
||||
int_raw = io.read(4)
|
||||
unless int_raw && int_raw.length == 4
|
||||
return nil
|
||||
end
|
||||
int = int_raw.unpack('N')[0]
|
||||
|
||||
int
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
# -*- coding: binary -*-
|
||||
|
||||
module Msf
|
||||
module Jmx
|
||||
module Util
|
||||
def get_instance_answer(stream)
|
||||
new_object = nil
|
||||
|
||||
if stream.contents[1]
|
||||
new_object = stream.contents[1]
|
||||
else
|
||||
print_error("#{peer} - getObjectInstance returned an incorrect answer")
|
||||
return nil
|
||||
end
|
||||
|
||||
unless new_object.class == Rex::Java::Serialization::Model::NewObject
|
||||
print_error("#{peer} - getObjectInstance didn't return a new object")
|
||||
return nil
|
||||
end
|
||||
|
||||
new_object.class_desc.description.class_name.contents
|
||||
end
|
||||
|
||||
def get_mbean_from_url_answer(stream)
|
||||
new_object = nil
|
||||
|
||||
if stream.contents[3]
|
||||
new_object = stream.contents[3]
|
||||
else
|
||||
print_error("#{peer} - getMBeansFromURL returned an incorrect answer")
|
||||
return nil
|
||||
end
|
||||
|
||||
unless new_object.class == Rex::Java::Serialization::Model::NewObject
|
||||
print_error("#{peer} - getMBeansFromURL didn't return a new object")
|
||||
return nil
|
||||
end
|
||||
|
||||
new_object.class_desc.description.class_name.contents
|
||||
end
|
||||
|
||||
def extract_string(io)
|
||||
raw_length = io.read(2)
|
||||
unless raw_length && raw_length.length == 2
|
||||
return nil
|
||||
end
|
||||
length = raw_length.unpack('n')[0]
|
||||
|
||||
string = io.read(length)
|
||||
unless string && string.length == length
|
||||
return nil
|
||||
end
|
||||
|
||||
string
|
||||
end
|
||||
|
||||
def extract_int(io)
|
||||
int_raw = io.read(4)
|
||||
unless int_raw && int_raw.length == 4
|
||||
return nil
|
||||
end
|
||||
int = int_raw.unpack('N')[0]
|
||||
|
||||
int
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue