Module: RubySMB::Dcerpc::Drsr::AttrtypResponsePlugin

Included in:
DrsMsgGetchgreplyV1, DrsMsgGetchgreplyV6, DrsMsgGetchgreplyV9
Defined in:
lib/ruby_smb/dcerpc/drsr.rb

Instance Method Summary collapse

Instance Method Details

#oid_from_attid(attr_typ) ⇒ Object



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/ruby_smb/dcerpc/drsr.rb', line 298

def oid_from_attid(attr_typ)
  upper_word = attr_typ / 0x10000
  lower_word = attr_typ % 0x10000
  prefix_table = self.prefix_table_src.p_prefix_entry
  binary_oid = nil
  prefix_table.each do |prefix_table_entry|
    if prefix_table_entry.ndx == upper_word
      binary_oid = prefix_table_entry.prefix.elements.to_ary.pack('C*')
      if lower_word < 128
        binary_oid << [lower_word].pack('C')
      else
        lower_word -= 0x8000 if lower_word >= 0x8000
        binary_oid << [((lower_word / 128) % 128) + 128].pack('C')
        binary_oid << [lower_word % 128].pack('C')
      end
      break
    end
  end

  return unless binary_oid
  OpenSSL::ASN1.decode("\x06#{[binary_oid.length].pack('C')}#{binary_oid}").value
end