[python-ldap] AD objectGUID conversion to string
Joseph L. Casale
jcasale at activenetwerx.com
Tue Sep 23 20:33:43 CEST 2014
> Hello, thanks for the replies, here is an example of the output of the
> objectGUID query: '\xd3\x18W|T\xc4!A\x90\xe3\xa7\xf7\xe8\xe1\xd9\xf1'
> Can anyone confirm what this format is?
> Thnaks.
As Michaels code illustrated, the value is byte encoded. Data in AD is typically
utf-16 encoded.
The "\xnn" notation is hexadecimal values, see string literals in the Python docs.
In [1]: import uuid
In [2]: s = b'\xd3\x18W|T\xc4!A\x90\xe3\xa7\xf7\xe8\xe1\xd9\xf1'
In [3]: uuid.UUID(bytes_le=s)
Out[3]: UUID('7c5718d3-c454-4121-90e3-a7f7e8e1d9f1')
hth,
jlc
More information about the python-ldap
mailing list