Use classes short name
parent
8f403f3eea
commit
2c290e2004
|
@ -27,7 +27,7 @@ module Rex
|
|||
loop do
|
||||
content = decode_content(io, stream)
|
||||
self.contents << content
|
||||
return self if content.class == Rex::Java::Serialization::Model::EndBlockData
|
||||
return self if content.class == EndBlockData
|
||||
end
|
||||
|
||||
self
|
||||
|
|
|
@ -65,31 +65,31 @@ module Rex
|
|||
encoded = ''
|
||||
|
||||
case content
|
||||
when Rex::Java::Serialization::Model::BlockData
|
||||
when BlockData
|
||||
encoded << [TC_BLOCKDATA].pack('C')
|
||||
when Rex::Java::Serialization::Model::BlockDataLong
|
||||
when BlockDataLong
|
||||
encoded << [TC_BLOCKDATALONG].pack('C')
|
||||
when Rex::Java::Serialization::Model::EndBlockData
|
||||
when EndBlockData
|
||||
encoded << [TC_ENDBLOCKDATA].pack('C')
|
||||
when Rex::Java::Serialization::Model::NewObject
|
||||
when NewObject
|
||||
encoded << [TC_OBJECT].pack('C')
|
||||
when Rex::Java::Serialization::Model::ClassDesc
|
||||
when ClassDesc
|
||||
encoded << [TC_CLASS].pack('C')
|
||||
when Rex::Java::Serialization::Model::NewArray
|
||||
when NewArray
|
||||
encoded << [TC_ARRAY].pack('C')
|
||||
when Rex::Java::Serialization::Model::Utf
|
||||
when Utf
|
||||
encoded << [TC_STRING].pack('C')
|
||||
when Rex::Java::Serialization::Model::LongUtf
|
||||
when LongUtf
|
||||
encoded << [TC_LONGSTRING].pack('C')
|
||||
when Rex::Java::Serialization::Model::NewEnum
|
||||
when NewEnum
|
||||
encoded << [TC_ENUM].pack('C')
|
||||
when Rex::Java::Serialization::Model::NewClassDesc
|
||||
when NewClassDesc
|
||||
encoded << [TC_CLASSDESC].pack('C')
|
||||
when Rex::Java::Serialization::Model::NullReference
|
||||
when NullReference
|
||||
encoded << [TC_NULL].pack('C')
|
||||
when Rex::Java::Serialization::Model::Reset
|
||||
when Reset
|
||||
encoded << [TC_RESET].pack('C')
|
||||
when Rex::Java::Serialization::Model::Reference
|
||||
when Reference
|
||||
encoded << [TC_REFERENCE].pack('C')
|
||||
else
|
||||
raise ::RuntimeError, 'Failed to serialize content'
|
||||
|
|
|
@ -50,7 +50,7 @@ module Rex
|
|||
# @return [String] if serialization succeeds
|
||||
# @raise [RuntimeError] if serialization doesn't succeed
|
||||
def encode
|
||||
unless array_description.class == Rex::Java::Serialization::Model::ClassDesc
|
||||
unless array_description.class == ClassDesc
|
||||
raise ::RuntimeError, 'Failed to serialize NewArray'
|
||||
end
|
||||
|
||||
|
@ -92,7 +92,7 @@ module Rex
|
|||
raise ::RuntimeError, 'Empty NewArray description'
|
||||
end
|
||||
|
||||
unless array_description.class == Rex::Java::Serialization::Model::ClassDesc
|
||||
unless array_description.class == ClassDesc
|
||||
raise ::RuntimeError, 'Unsupported NewArray description class'
|
||||
end
|
||||
|
||||
|
@ -198,7 +198,7 @@ module Rex
|
|||
res = [value].pack('s>')
|
||||
when 'boolean'
|
||||
res = [value].pack('c')
|
||||
when Rex::Java::Serialization::Model::Element
|
||||
when Element
|
||||
res = value.encode
|
||||
else # object
|
||||
res = encode_content(value)
|
||||
|
|
|
@ -39,8 +39,8 @@ module Rex
|
|||
# @return [String] if serialization succeeds
|
||||
# @raise [RuntimeError] if serialization doesn't succeed
|
||||
def encode
|
||||
unless enum_description.class == Rex::Java::Serialization::Model::ClassDesc &&
|
||||
constant_name.class == Rex::Java::Serialization::Model::Utf
|
||||
unless enum_description.class == ClassDesc &&
|
||||
constant_name.class == Utf
|
||||
raise ::RuntimeError, 'Failed to serialize EnumDescription'
|
||||
end
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ module Rex
|
|||
self.class_desc = ClassDesc.decode(io, stream)
|
||||
stream.add_reference(self) unless stream.nil?
|
||||
|
||||
if class_desc.description.class == Rex::Java::Serialization::Model::NewClassDesc
|
||||
if class_desc.description.class == NewClassDesc
|
||||
self.class_data = decode_class_data(io, class_desc.description)
|
||||
elsif class_desc.description.class == Rex::Java::Serialization::Model::Reference
|
||||
elsif class_desc.description.class == Reference
|
||||
ref = class_desc.description.handle - BASE_WIRE_HANDLE
|
||||
self.class_data = decode_class_data(io, stream.references[ref])
|
||||
end
|
||||
|
@ -45,7 +45,7 @@ module Rex
|
|||
# @return [String] if serialization succeeds
|
||||
# @raise [RuntimeError] if serialization doesn't succeed
|
||||
def encode
|
||||
unless class_desc.class == Rex::Java::Serialization::Model::ClassDesc
|
||||
unless class_desc.class == ClassDesc
|
||||
raise ::RuntimeError, 'Failed to serialize NewObject'
|
||||
end
|
||||
|
||||
|
@ -74,7 +74,7 @@ module Rex
|
|||
def decode_class_data(io, my_class_desc)
|
||||
values = []
|
||||
|
||||
unless my_class_desc.super_class.description.class == Rex::Java::Serialization::Model::NullReference
|
||||
unless my_class_desc.super_class.description.class == NullReference
|
||||
values += decode_class_data(io, my_class_desc.super_class.description)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue