Class: Rex::Proto::DRDA::RDBNAM_PARAM

Inherits:
Struct
  • Object
show all
Defined in:
lib/rex/proto/drda/packet.rb

Overview

Relational Database name parameter.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ RDBNAM_PARAM

Returns a new instance of RDBNAM_PARAM


63
64
65
66
67
# File 'lib/rex/proto/drda/packet.rb', line 63

def initialize(args={})
  self[:length] = 22 # Since the database name is padded out.
  self[:codepoint] = Constants::RDBNAM
  self[:payload] = encode(args[:payload].to_s)
end

Instance Attribute Details

#codepointObject

Returns the value of attribute codepoint

Returns:

  • (Object)

    the current value of codepoint


62
63
64
# File 'lib/rex/proto/drda/packet.rb', line 62

def codepoint
  @codepoint
end

#lengthObject

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length


62
63
64
# File 'lib/rex/proto/drda/packet.rb', line 62

def length
  @length
end

#payloadObject

Returns the value of attribute payload

Returns:

  • (Object)

    the current value of payload


62
63
64
# File 'lib/rex/proto/drda/packet.rb', line 62

def payload
  @payload
end

Instance Method Details

#encode(str) ⇒ Object


69
70
71
# File 'lib/rex/proto/drda/packet.rb', line 69

def encode(str)
  Rex::Text.to_ebcdic([str].pack("A18"))
end

#to_sObject


77
78
79
# File 'lib/rex/proto/drda/packet.rb', line 77

def to_s
  self.to_a.pack("nna18")
end