class Rex::Proto::Rmi::Model::OutputHeader
This class provides a representation of an RMI output stream header
Attributes
protocol[RW]
@!attribute protocol
@return [Fixnum] the protocol where the the messages are wrapped within
signature[RW]
@!attribute signature
@return [String] the Java RMI header signature
version[RW]
@!attribute version
@return [Fixnum] the Java RMI version
Private Instance Methods
decode_protocol(io)
click to toggle source
Reads the protocol from the IO
@param io [IO] the IO
to read from @return [Fixnum] @raise [Rex::Proto::Rmi::DecodeError] if fails to decode the protocol
# File lib/rex/proto/rmi/model/output_header.rb, line 50 def decode_protocol(io) valid_protocols = [STREAM_PROTOCOL, SINGLE_OP_PROTOCOL, MULTIPLEX_PROTOCOL] protocol = read_byte(io) unless valid_protocols.include?(protocol) raise Rex::Proto::Rmi::DecodeError, 'Failed to decode OutputHeader protocol' end protocol end
decode_signature(io)
click to toggle source
Reads the signature from the IO
@param io [IO] the IO
to read from @return [String] @raise [Rex::Proto::Rmi::DecodeError] if fails to decode signature
# File lib/rex/proto/rmi/model/output_header.rb, line 26 def decode_signature(io) signature = read_string(io, 4) unless signature == SIGNATURE raise Rex::Proto::Rmi::DecodeError, 'Failed to decode OutputHeader signature' end signature end
decode_version(io)
click to toggle source
encode_protocol()
click to toggle source
Encodes the protocol field
@return [String]
# File lib/rex/proto/rmi/model/output_header.rb, line 78 def encode_protocol [protocol].pack('C') end
encode_signature()
click to toggle source
Encodes the signature field
@return [String]
# File lib/rex/proto/rmi/model/output_header.rb, line 64 def encode_signature signature end
encode_version()
click to toggle source
Encodes the version field
@return [String]
# File lib/rex/proto/rmi/model/output_header.rb, line 71 def encode_version [version].pack('n') end