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.



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

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.



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

def active
  @active
end

Instance Method Details

#data_sizeObject



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

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

#parse(str, offset = 0) ⇒ Object



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

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



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

def serialize
  super if @active
end

#valueObject



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

def value
  @value
end

#value=(val) ⇒ Object



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

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