File: blob.rb

package info (click to toggle)
ruby-ntlm 0.6.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 408 kB
  • sloc: ruby: 2,663; makefile: 6
file content (28 lines) | stat: -rw-r--r-- 817 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Net
  module NTLM

    BLOB_SIGN = 0x00000101

    class Blob < FieldSet
      int32LE    :blob_signature, {:value => BLOB_SIGN}
      int32LE    :reserved,       {:value => 0}
      int64LE    :timestamp,      {:value => 0}
      string     :challenge,      {:value => "", :size => 8}
      int32LE    :unknown1,       {:value => 0}
      string     :target_info,    {:value => "", :size => 0}
      int32LE    :unknown2,       {:value => 0}

      def parse(str, offset=0)
        # 28 is the length of all fields before the variable-length
        # target_info field.
        if str.size > 28
          enable(:target_info)
          # Grab everything except the last 4 bytes (which will be :unknown2)
          self[:target_info].value = str[28..-5]
        end
        super
      end
    end

  end
end