Class: Rex::Proto::Rmi::Model::CallData

Inherits:
Element
  • Object
show all
Defined in:
lib/rex/proto/rmi/model/call_data.rb

Overview

This class provides a representation of an RMI return value

Constant Summary

Constants included from Rex::Proto::Rmi::Model

CALL_MESSAGE, DGC_ACK_MESSAGE, MULTIPLEX_PROTOCOL, PING_ACK, PING_MESSAGE, PROTOCOL_ACK, PROTOCOL_NOT_SUPPORTED, RETURN_DATA, RETURN_EXCEPTION, RETURN_VALUE, SIGNATURE, SINGLE_OP_PROTOCOL, STREAM_PROTOCOL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Element

attr_accessor, attributes, #attributes, decode, #initialize

Constructor Details

This class inherits a constructor from Rex::Proto::Rmi::Model::Element

Instance Attribute Details

#argumentsArray

Returns the returned exception or value according to code.

Returns:

  • (Array)

    the returned exception or value according to code


26
27
28
# File 'lib/rex/proto/rmi/model/call_data.rb', line 26

def arguments
  @arguments
end

#hashInteger

Returns On JDK 1.1 stub protocol the stub's interface hash. On JDK1.2 is a hash representing the method to call.

Returns:

  • (Integer)

    On JDK 1.1 stub protocol the stub's interface hash. On JDK1.2 is a hash representing the method to call.


23
24
25
# File 'lib/rex/proto/rmi/model/call_data.rb', line 23

def hash
  @hash
end

#object_numberInteger

Returns Random to identify the object being called.

Returns:

  • (Integer)

    Random to identify the object being called


12
13
14
# File 'lib/rex/proto/rmi/model/call_data.rb', line 12

def object_number
  @object_number
end

#operationInteger

Returns On JDK 1.1 stub protocol the operation index in the interface. On JDK 1.2 it is -1.

Returns:

  • (Integer)

    On JDK 1.1 stub protocol the operation index in the interface. On JDK 1.2 it is -1.


19
20
21
# File 'lib/rex/proto/rmi/model/call_data.rb', line 19

def operation
  @operation
end

#uidRex::Proto::Rmi::Model::UniqueIdentifier

Returns unique identifier for the target to call.

Returns:


15
16
17
# File 'lib/rex/proto/rmi/model/call_data.rb', line 15

def uid
  @uid
end

Instance Method Details

#decode(io) ⇒ Rex::Proto::Rmi::Model::CallData

Decodes the Rex::Proto::Rmi::Model::CallData from the input.

Parameters:

  • io (IO)

    the IO to read from

Returns:


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/rex/proto/rmi/model/call_data.rb', line 45

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

#encodeString

Encodes the Rex::Proto::Rmi::Model::CallData into an String.

Returns:

  • (String)

31
32
33
34
35
36
37
38
39
# File 'lib/rex/proto/rmi/model/call_data.rb', line 31

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