Class: Rex::Proto::NTLM::Base::String
- Defined in:
- lib/rex/proto/ntlm/base.rb
Instance Attribute Summary
Attributes inherited from Field
Instance Method Summary collapse
-
#initialize(opts) ⇒ String
constructor
A new instance of String.
- #parse(str, offset = 0) ⇒ Object
- #serialize ⇒ Object
- #value=(val) ⇒ Object
Methods inherited from Field
Constructor Details
#initialize(opts) ⇒ String
Returns a new instance of String.
69 70 71 72 |
# File 'lib/rex/proto/ntlm/base.rb', line 69 def initialize(opts) super(opts) @size = opts[:size] end |
Instance Method Details
#parse(str, offset = 0) ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/rex/proto/ntlm/base.rb', line 74 def parse(str, offset=0) if @active and str.size >= offset + @size @value = str[offset, @size] @size else 0 end end |
#serialize ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/rex/proto/ntlm/base.rb', line 83 def serialize if @active @value else "" end end |
#value=(val) ⇒ Object
91 92 93 94 95 |
# File 'lib/rex/proto/ntlm/base.rb', line 91 def value=(val) @value = val @size = @value.nil? ? 0 : @value.size @active = (@size > 0) end |