Class: Rex::Proto::NTLM::Base::Int16LE

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) ⇒ Int16LE

Returns a new instance of Int16LE.



103
104
105
106
# File 'lib/rex/proto/ntlm/base.rb', line 103

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

Instance Method Details

#parse(str, offset = 0) ⇒ Object



108
109
110
111
112
113
114
115
# File 'lib/rex/proto/ntlm/base.rb', line 108

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

#serializeObject



117
118
119
# File 'lib/rex/proto/ntlm/base.rb', line 117

def serialize
	[@value].pack("v")
end