2014-12-10 09:52:23 -06:00
|
|
|
# -*- coding: binary -*-
|
|
|
|
|
|
2014-12-01 19:07:45 -06:00
|
|
|
module Rex
|
|
|
|
|
module Java
|
|
|
|
|
module Serialization
|
|
|
|
|
module Model
|
|
|
|
|
class Element
|
2014-12-02 09:02:24 -06:00
|
|
|
|
2014-12-05 12:42:27 -06:00
|
|
|
attr_accessor :stream
|
|
|
|
|
|
2014-12-09 19:37:42 -06:00
|
|
|
# Deserializes a Rex::Java::Serialization::Model::Element
|
2014-12-02 09:02:24 -06:00
|
|
|
#
|
|
|
|
|
# @param io [IO] the io to read from
|
2014-12-09 19:37:42 -06:00
|
|
|
# @return [Rex::Java::Serialization::Model::Element] if deserialization succeeds
|
2014-12-03 14:59:38 -06:00
|
|
|
# @return [nil] if deserialization doesn't succeed
|
2014-12-05 16:52:59 -06:00
|
|
|
def self.decode(io, stream = nil)
|
|
|
|
|
elem = self.new(stream)
|
2014-12-01 19:07:45 -06:00
|
|
|
elem.decode(io)
|
|
|
|
|
end
|
|
|
|
|
|
2014-12-05 20:11:45 -06:00
|
|
|
# @param stream [Rex::Java::Serialization::Model::Stream] the stream where it belongs to
|
2014-12-05 16:52:59 -06:00
|
|
|
def initialize(stream = nil)
|
|
|
|
|
self.stream = stream
|
2014-12-01 19:07:45 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def decode(io)
|
|
|
|
|
self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def encode
|
|
|
|
|
''
|
|
|
|
|
end
|
2014-12-07 17:52:09 -06:00
|
|
|
|
|
|
|
|
# Creates a print-friendly string representation
|
|
|
|
|
#
|
|
|
|
|
# @return [String]
|
|
|
|
|
def to_s
|
|
|
|
|
self.class.name.split('::').last
|
|
|
|
|
end
|
2014-12-01 19:07:45 -06:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|