different GUID formats in AD?
Gémes Géza
geza at kzsdabas.hu
Wed Apr 3 03:17:52 MDT 2013
Hi,
I would need some info about the possible GUID formats.
If I run the following python code on a DC:
#!/usr/bin/env python
import sys, getpass
sys.path.insert(0,"/usr/local/samba/lib/python2.7/site-packages")
import ldb
from samba.ndr import ndr_pack, ndr_unpack
from samba import dsdb
from samba.dcerpc import misc
from samba.samdb import SamDB
from samba.param import LoadParm
from samba.auth import system_session
from samba.credentials import Credentials
username=raw_input("Username: ")
password=getpass.getpass()
lp = LoadParm()
creds = Credentials()
creds.guess(lp)
creds.set_username(username)
creds.set_password(password)
samdb = SamDB(url='ldap://localhost', session_info=system_session(),
credentials=creds, lp=lp)
domain_dn = samdb.domain_dn()
dnsname=samdb.host_dns_name()
res = samdb.search(domain_dn, scope=ldb.SCOPE_SUBTREE,
expression=("(&(objectClass=computer)(dNSHostName=%s)(userAccountControl:%s:=%u))"
% (dnsname, ldb.OID_COMPARATOR_AND,
dsdb.UF_SERVER_TRUST_ACCOUNT)),
attrs=["objectGUID"])
print("%s\n" % ndr_unpack(misc.GUID, msg.get("objectGUID", idx=0)[0]))
print("%s\n" % (msg.get("objectGUID", idx=0)[0]))
First I get the usual text representation of the GUID:
c848f583-71f2-435b-afb6-8d5c9df4ae58
Second a binary string is printed.
What I would need to obtain is a different text representation like:
83f548c8f2715b43afb68d5c9df4ae5, which can be obtained by a visual basic
script I've posted on this thread before.
I've seen, that this format differs from the text representation, just
by swapping some bytes, but would want to know if there is any other way
to obtain it.
Thank you for any idea!
Cheers
Geza Gemes
More information about the samba-technical
mailing list