class Rex::Proto::Kerberos::Model::LastRequest

This class provides a representation of request time

Attributes

type[RW]

@!attribute type

@return [Fixnum] The type of value
value[RW]

@!attribute value

@return [Time] the time of the last request

Public Instance Methods

decode(input) click to toggle source

Decodes a Rex::Proto::Kerberos::Model::LastRequest

@param input [String, OpenSSL::ASN1::Sequence] the input to decode from @return [self] if decoding succeeds @raise [RuntimeError] if decoding doesn't succeed

# File lib/rex/proto/kerberos/model/last_request.rb, line 21
def decode(input)
  case input
  when String
    decode_string(input)
  when OpenSSL::ASN1::Sequence
    decode_asn1(input)
  else
    raise ::RuntimeError, 'Failed to decode LastRequest, invalid input'
  end

  self
end
encode() click to toggle source

Rex::Proto::Kerberos::Model::LastRequest encoding isn't supported

@raise [NotImplementedError]

# File lib/rex/proto/kerberos/model/last_request.rb, line 37
def encode
  raise ::NotImplementedError, 'LastRequest encoding not supported'
end

Private Instance Methods

decode_asn1(input) click to toggle source

Decodes a Rex::Proto::Kerberos::Model::EncryptionKey from an OpenSSL::ASN1::Sequence

@param input [OpenSSL::ASN1::Sequence] the input to decode from

# File lib/rex/proto/kerberos/model/last_request.rb, line 56
def decode_asn1(input)
  seq_values = input.value
  self.type = decode_type(seq_values[0])
  self.value = decode_value(seq_values[1])
end
decode_string(input) click to toggle source

Decodes a Rex::Proto::Kerberos::Model::LastReque from an String

@param input [String] the input to decode from

# File lib/rex/proto/kerberos/model/last_request.rb, line 46
def decode_string(input)
  asn1 = OpenSSL::ASN1.decode(input)

  decode_asn1(asn1)
end
decode_type(input) click to toggle source

Decodes the key_type from an OpenSSL::ASN1::ASN1Data

@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Fixnum]

# File lib/rex/proto/kerberos/model/last_request.rb, line 66
def decode_type(input)
  input.value[0].value.to_i
end
decode_value(input) click to toggle source

Decodes the value from an OpenSSL::ASN1::ASN1Data

@param input [OpenSSL::ASN1::ASN1Data] the input to decode from @return [Time]

# File lib/rex/proto/kerberos/model/last_request.rb, line 74
def decode_value(input)
  input.value[0].value
end