Class: Rex::Proto::DRDA::SECCHK_DDM

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ SECCHK_DDM

Takes :dbname, :dbpass, :dbuser



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/rex/proto/drda/packet.rb', line 224

def initialize(args={}) # Takes :dbname, :dbpass, :dbuser
  self[:magic] = 0xd0
  self[:format] = 0x01
  self[:correlid] = 2
  self[:codepoint] = Constants::SECCHK
  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[:password] = PASSWORD_PARAM.new(:payload => args[:dbpass]).to_s
  self[:userid] = USERID_PARAM.new(:payload => args[:dbuser]).to_s
  self[:length] = ( 10 + self[:secmec].to_s.size + self[:rdbnam].to_s.size +
         self[:password].to_s.size + self[:userid].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



222
223
224
# File 'lib/rex/proto/drda/packet.rb', line 222

def codepoint
  @codepoint
end

#correlidObject

Returns the value of attribute correlid

Returns:

  • (Object)

    the current value of correlid



222
223
224
# File 'lib/rex/proto/drda/packet.rb', line 222

def correlid
  @correlid
end

#formatObject

Returns the value of attribute format

Returns:

  • (Object)

    the current value of format



222
223
224
# File 'lib/rex/proto/drda/packet.rb', line 222

def format
  @format
end

#lengthObject

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



222
223
224
# File 'lib/rex/proto/drda/packet.rb', line 222

def length
  @length
end

#length2Object

Returns the value of attribute length2

Returns:

  • (Object)

    the current value of length2



222
223
224
# File 'lib/rex/proto/drda/packet.rb', line 222

def length2
  @length2
end

#magicObject

Returns the value of attribute magic

Returns:

  • (Object)

    the current value of magic



222
223
224
# File 'lib/rex/proto/drda/packet.rb', line 222

def magic
  @magic
end

#passwordObject

Returns the value of attribute password

Returns:

  • (Object)

    the current value of password



222
223
224
# File 'lib/rex/proto/drda/packet.rb', line 222

def password
  @password
end

#rdbnamObject

Returns the value of attribute rdbnam

Returns:

  • (Object)

    the current value of rdbnam



222
223
224
# File 'lib/rex/proto/drda/packet.rb', line 222

def rdbnam
  @rdbnam
end

#secmecObject

Returns the value of attribute secmec

Returns:

  • (Object)

    the current value of secmec



222
223
224
# File 'lib/rex/proto/drda/packet.rb', line 222

def secmec
  @secmec
end

#useridObject

Returns the value of attribute userid

Returns:

  • (Object)

    the current value of userid



222
223
224
# File 'lib/rex/proto/drda/packet.rb', line 222

def userid
  @userid
end

Instance Method Details

#dbname=(str) ⇒ Object



239
240
241
# File 'lib/rex/proto/drda/packet.rb', line 239

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

#to_sObject



242
243
244
245
246
247
# File 'lib/rex/proto/drda/packet.rb', line 242

def to_s
  packstr = "nCCnnna6"
  packstr += "a22" if self[:rdbnam]
  packstr += "a*a*" # username and password
  self.to_a.pack(packstr)
end