class Rex::Proto::Rmi::Model::CallData
This class provides a representation of an RMI return value
Attributes
arguments[RW]
@!attribute arguments
@return [Array] the returned exception or value according to code
hash[RW]
@!attribute hash
@return [Fixnum] On JDK 1.1 stub protocol the stub's interface hash. On JDK1.2 is a hash representing the method to call.
object_number[RW]
@!attribute object_number
@return [Fixnum] Random to identify the object being called
operation[RW]
@!attribute operation
@return [Fixnum] On JDK 1.1 stub protocol the operation index in the interface. On JDK 1.2 it is -1.
uid[RW]
@!attribute uid
@return [Rex::Proto::Rmi::Model::UniqueIdentifier] unique identifier for the target to call
Public Instance Methods
decode(io)
click to toggle source
Decodes the Rex::Proto::Rmi::Model::CallData
from the input.
@param io [IO] the IO
to read from @return [Rex::Proto::Rmi::Model::CallData]
# File lib/rex/proto/rmi/model/call_data.rb, line 44 def decode(io) stream = Rex::Java::Serialization::Model::Stream.decode(io) block_data = stream.contents[0] block_data_io = StringIO.new(block_data.contents, 'rb') self.object_number = decode_object_number(block_data_io) self.uid = decode_uid(block_data_io) self.operation = decode_operation(block_data_io) self.hash = decode_hash(block_data_io) self.arguments = [] stream.contents[1..stream.contents.length - 1].each do |content| self.arguments << content end self end
encode()
click to toggle source
Encodes the Rex::Proto::Rmi::Model::CallData
into an String.
@return [String]
# File lib/rex/proto/rmi/model/call_data.rb, line 30 def encode stream = Rex::Java::Serialization::Model::Stream.new block_data = Rex::Java::Serialization::Model::BlockData.new(nil, encode_object_number + encode_uid + encode_operation + encode_hash) stream.contents << block_data stream.contents += arguments stream.encode end
Private Instance Methods
decode_hash(io)
click to toggle source
decode_object_number(io)
click to toggle source
decode_operation(io)
click to toggle source
decode_uid(io)
click to toggle source
encode_hash()
click to toggle source
Encodes the hash field
@return [String]
# File lib/rex/proto/rmi/model/call_data.rb, line 129 def encode_hash [hash].pack('q>') end
encode_object_number()
click to toggle source
Encodes the code field
@return [String]
# File lib/rex/proto/rmi/model/call_data.rb, line 108 def encode_object_number [object_number].pack('q>') end
encode_operation()
click to toggle source
Encodes the operation field
@return [String]
# File lib/rex/proto/rmi/model/call_data.rb, line 122 def encode_operation [operation].pack('l>') end
encode_uid()
click to toggle source
Encodes the uid field
@return [String]
# File lib/rex/proto/rmi/model/call_data.rb, line 115 def encode_uid uid.encode end