Class: Rex::Proto::NTLM::Base::SecurityBuffer

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/proto/ntlm/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ SecurityBuffer

Returns a new instance of SecurityBuffer.



289
290
291
292
293
294
# File 'lib/rex/proto/ntlm/base.rb', line 289

def initialize(opts)
  super()
  @value  = opts[:value]
  @active = opts[:active].nil? ? true : opts[:active]
  @size = 8
end

Instance Attribute Details

#activeObject

Returns the value of attribute active.



288
289
290
# File 'lib/rex/proto/ntlm/base.rb', line 288

def active
  @active
end

Instance Method Details

#data_sizeObject



319
320
321
# File 'lib/rex/proto/ntlm/base.rb', line 319

def data_size
  @active ? @value.size : 0
end

#parse(str, offset = 0) ⇒ Object



296
297
298
299
300
301
302
303
304
# File 'lib/rex/proto/ntlm/base.rb', line 296

def parse(str, offset=0)
  if @active and str.size >= offset + @size
    super(str, offset)
    @value = str[self.offset, self.length]
    @size
  else
    0
  end
end

#serializeObject



306
307
308
# File 'lib/rex/proto/ntlm/base.rb', line 306

def serialize
  super if @active
end

#valueObject



310
311
312
# File 'lib/rex/proto/ntlm/base.rb', line 310

def value
  @value
end

#value=(val) ⇒ Object



314
315
316
317
# File 'lib/rex/proto/ntlm/base.rb', line 314

def value=(val)
  @value = val
  self.length = self.allocated = val.size
end