Class: RubySMB::Dcerpc::Uuid

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/ruby_smb/dcerpc/uuid.rb

Overview

Direct Known Subclasses

Ndr::UuidPtr

Instance Method Summary collapse

Instance Method Details

#getObject



16
17
18
19
20
21
22
# File 'lib/ruby_smb/dcerpc/uuid.rb', line 16

def get
  "#{to_string_le(time_low.to_binary_s)}"\
  "-#{to_string_le(time_mid.to_binary_s)}"\
  "-#{to_string_le(time_hi_and_version.to_binary_s)}"\
  "-#{clock_seq_hi_and_reserved.to_hex}#{clock_seq_low.to_hex}"\
  "-#{node.to_hex}"
end

#set(uuid_string) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ruby_smb/dcerpc/uuid.rb', line 24

def set(uuid_string)
  uuid_string.delete_suffix!('}')
  uuid_string.delete_prefix!('{')
  components = uuid_string.split('-')
  self.time_low.read(to_binary_le(components[0]))
  self.time_mid.read(to_binary_le(components[1]))
  self.time_hi_and_version.read(to_binary_le(components[2]))
  self.clock_seq_hi_and_reserved.read(components[3][0,2].hex.chr)
  self.clock_seq_low.read(components[3][2,2].hex.chr)
  self.node.read(components[4].gsub(/../) {|e| e.hex.chr})
end