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.



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

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



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

def codepoint
  @codepoint
end

#correlidObject

Returns the value of attribute correlid

Returns:

  • (Object)

    the current value of correlid



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

def correlid
  @correlid
end

#formatObject

Returns the value of attribute format

Returns:

  • (Object)

    the current value of format



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

def format
  @format
end

#lengthObject

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



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

def length
  @length
end

#length2Object

Returns the value of attribute length2

Returns:

  • (Object)

    the current value of length2



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

def length2
  @length2
end

#magicObject

Returns the value of attribute magic

Returns:

  • (Object)

    the current value of magic



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

def magic
  @magic
end

#rdbnamObject

Returns the value of attribute rdbnam

Returns:

  • (Object)

    the current value of rdbnam



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

def rdbnam
  @rdbnam
end

#secmecObject

Returns the value of attribute secmec

Returns:

  • (Object)

    the current value of secmec



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

def secmec
  @secmec
end

Instance Method Details

#dbname=(str) ⇒ Object



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

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

#to_sObject



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

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