Class: Rex::Proto::DRDA::ACCSEC_DDM

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

Overview

The ACCSEC DDM is responsible for picking the security mechanism (SECMEC) which, in our case, will always be plain text username and password. It also sets the relational database name (RDBNAM), if specified. You need one to login, but not to probe.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ ACCSEC_DDM

Returns a new instance of ACCSEC_DDM.



89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/rex/proto/drda/packet.rb', line 89

def initialize(args={})
  self[:magic] = 0xd0
  self[:format] = args[:format] || 0x01
  self[:correlid] = 2
  self[:codepoint] = Constants::ACCSEC
  self[:secmec] = SECMEC_PARAM.new.to_s
  if args[:dbname] # Include a database name if we're given one.
    self[:rdbnam] = RDBNAM_PARAM.new(:payload => args[:dbname]).to_s
  end
  self[:length] =  10 + self[:secmec].to_s.size + self[:rdbnam].to_s.size
  self[:length2] = self[:length]-6
end

Instance Attribute Details

#codepointObject

Returns the value of attribute codepoint

Returns:

  • (Object)

    the current value of codepoint



87
88
89
# File 'lib/rex/proto/drda/packet.rb', line 87

def codepoint
  @codepoint
end

#correlidObject

Returns the value of attribute correlid

Returns:

  • (Object)

    the current value of correlid



87
88
89
# File 'lib/rex/proto/drda/packet.rb', line 87

def correlid
  @correlid
end

#formatObject

Returns the value of attribute format

Returns:

  • (Object)

    the current value of format



87
88
89
# File 'lib/rex/proto/drda/packet.rb', line 87

def format
  @format
end

#lengthObject

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



87
88
89
# File 'lib/rex/proto/drda/packet.rb', line 87

def length
  @length
end

#length2Object

Returns the value of attribute length2

Returns:

  • (Object)

    the current value of length2



87
88
89
# File 'lib/rex/proto/drda/packet.rb', line 87

def length2
  @length2
end

#magicObject

Returns the value of attribute magic

Returns:

  • (Object)

    the current value of magic



87
88
89
# File 'lib/rex/proto/drda/packet.rb', line 87

def magic
  @magic
end

#rdbnamObject

Returns the value of attribute rdbnam

Returns:

  • (Object)

    the current value of rdbnam



87
88
89
# File 'lib/rex/proto/drda/packet.rb', line 87

def rdbnam
  @rdbnam
end

#secmecObject

Returns the value of attribute secmec

Returns:

  • (Object)

    the current value of secmec



87
88
89
# File 'lib/rex/proto/drda/packet.rb', line 87

def secmec
  @secmec
end

Instance Method Details

#dbname=(str) ⇒ Object



101
102
103
# File 'lib/rex/proto/drda/packet.rb', line 101

def dbname=(str)
  self[:rdbnam] = RDBNAM_PARAM.new(:payload => args[:dbname]).to_s
end

#to_sObject



104
105
106
107
108
# File 'lib/rex/proto/drda/packet.rb', line 104

def to_s
  packstr = "nCCnnna6"
  packstr += "a22" if self[:rdbnam]
  self.to_a.pack(packstr)
end