Class: Rex::Proto::NTLM::Base::Int32LE

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

Instance Attribute Summary

Attributes inherited from Field

#active, #value

Instance Method Summary collapse

Methods inherited from Field

#size

Constructor Details

#initialize(opt) ⇒ Int32LE

Returns a new instance of Int32LE.



119
120
121
122
# File 'lib/rex/proto/ntlm/base.rb', line 119

def initialize(opt)
  super(opt)
  @size = 4
end

Instance Method Details

#parse(str, offset = 0) ⇒ Object



124
125
126
127
128
129
130
131
# File 'lib/rex/proto/ntlm/base.rb', line 124

def parse(str, offset=0)
  if @active and str.size >= offset + @size
    @value = str.slice(offset, @size).unpack("V")[0]
    @size
  else
    0
  end
end

#serializeObject



133
134
135
# File 'lib/rex/proto/ntlm/base.rb', line 133

def serialize
  [@value].pack("V") if @active
end