class Rex::Proto::Rmi::Model::ProtocolAck

This class provides a representation of an RMI protocol ack input stream

Attributes

address[RW]

@!attribute address

@return [String] the end point address
length[RW]

@!attribute length

@return [Fixnum] the end point address length
port[RW]

@!attribute port

@return [Fixnum] the end point port
stream_id[RW]

@!attribute stream_id

@return [Fixnum] the input stream id

Private Instance Methods

decode_address(io) click to toggle source

Reads the end point address from the IO

@param io [IO] the IO to read from @return [String]

# File lib/rex/proto/rmi/model/protocol_ack.rb, line 52
def decode_address(io)
  version = read_string(io, length)

  version
end
decode_length(io) click to toggle source

Reads the end point identifier address length from the IO

@param io [IO] the IO to read from @return [Fixnum]

# File lib/rex/proto/rmi/model/protocol_ack.rb, line 42
def decode_length(io)
  length = read_short(io)

  length
end
decode_port(io) click to toggle source

Reads the end point port from the IO

@param io [IO] the IO to read from @return [Fixnum]

# File lib/rex/proto/rmi/model/protocol_ack.rb, line 62
def decode_port(io)
  port = read_int(io)

  port
end
decode_stream_id(io) click to toggle source

Reads the stream id from the IO

@param io [IO] the IO to read from @return [String] @raise [Rex::Proto::Rmi::DecodeError] if fails to decode stream id

# File lib/rex/proto/rmi/model/protocol_ack.rb, line 29
def decode_stream_id(io)
  stream_id = read_byte(io)
  unless stream_id == PROTOCOL_ACK
    raise Rex::Proto::Rmi::DecodeError, 'Failed to decode ProtocolAck stream id'
  end

  stream_id
end
encode_address() click to toggle source

Encodes the address field

@return [String]

# File lib/rex/proto/rmi/model/protocol_ack.rb, line 85
def encode_address
  address
end
encode_length() click to toggle source

Encodes the length field

@return [String]

# File lib/rex/proto/rmi/model/protocol_ack.rb, line 78
def encode_length
  [length].pack('n')
end
encode_port() click to toggle source

Encodes the port field

@return [String]

# File lib/rex/proto/rmi/model/protocol_ack.rb, line 92
def encode_port
  [port].pack('N')
end
encode_stream_id() click to toggle source

Encodes the stream_id field

@return [String]

# File lib/rex/proto/rmi/model/protocol_ack.rb, line 71
def encode_stream_id
  [stream_id].pack('C')
end