class Rex::Proto::DCERPC::UUID

Public Class Methods

is?(uuid_str) click to toggle source

Validate a text based UUID

# File lib/rex/proto/dcerpc/uuid.rb, line 34
def self.is? (uuid_str)
  raise ArgumentError if !uuid_str
  if uuid_str.match(/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/)
    return true
  else
    return false
  end
end
uuid_by_name(name) click to toggle source

Determine the UUID string for the DCERPC service with this name

# File lib/rex/proto/dcerpc/uuid.rb, line 61
def self.uuid_by_name (name)
  if @@known_uuids.key?(name)
    @@known_uuids[name][0]
  end
end
uuid_pack(uuid_str) click to toggle source

Convert a UUID in string format to the binary representation

# File lib/rex/proto/dcerpc/uuid.rb, line 44
def self.uuid_pack (uuid_str)
  raise ArgumentError if !self.is?(uuid_str)
  parts = uuid_str.split('-')
  [ parts[0].hex, parts[1].hex, parts[2].hex, parts[3].hex ].pack('Vvvn') + [ parts[4] ].pack('H*')
end
uuid_unpack(uuid_bin) click to toggle source

Convert a UUID in binary format to the string representation

# File lib/rex/proto/dcerpc/uuid.rb, line 22
def self.uuid_unpack(uuid_bin)
  raise ArgumentError if uuid_bin.length != 16
  sprintf("%.8x-%.4x-%.4x-%.4x-%s",
    uuid_bin[ 0, 4].unpack('V')[0],
    uuid_bin[ 4, 2].unpack('v')[0],
    uuid_bin[ 6, 2].unpack('v')[0],
    uuid_bin[ 8, 2].unpack('n')[0],
    uuid_bin[10, 6].unpack('H*')[0]
  )
end
vers_by_name(name) click to toggle source

Determine the common version number for the DCERPC service with this name

# File lib/rex/proto/dcerpc/uuid.rb, line 68
def self.vers_by_name (name)
  if @@known_uuids.key?(name)
    @@known_uuids[name][1]
  end
end
vers_to_nums(vers) click to toggle source

Convert a string or number in float format to two unique numbers 2.0 => [2, 0]

# File lib/rex/proto/dcerpc/uuid.rb, line 75
def self.vers_to_nums (vers)
  vers_maj = vers.to_i
  vers_min = ((vers.to_f - vers.to_i) * 10).to_i
  return vers_maj, vers_min
end
xfer_syntax_uuid() click to toggle source

Provide the common TransferSyntax UUID in packed format

# File lib/rex/proto/dcerpc/uuid.rb, line 51
def self.xfer_syntax_uuid ()
  self.uuid_pack('8a885d04-1ceb-11c9-9fe8-08002b104860')
end
xfer_syntax_vers() click to toggle source

Provide the common TransferSyntax version number

# File lib/rex/proto/dcerpc/uuid.rb, line 56
def self.xfer_syntax_vers ()
  '2.0'
end