Converting binary sid's to a hex string
- From: "LittlePython" <LittlePython@xxxxxxxx>
- Date: Wed, 07 Jun 2006 17:34:48 GMT
I am trying to create a hexstring of a NT4 user account sid which I can in
turn use to query an exchange 55 database. I believe I need to convert a
binary sid to a hex string. ADsSID com object will do this for me however it
is a little slow. Can anybody point me in the right direction to converting
a PySID to a hexstring.
Thx
import win32netcon
import win32net
import win32security
def report():
resume = 0
while 1:
filter = win32netcon.FILTER_NORMAL_ACCOUNT
data, total, resume = win32net.NetUserEnum('nt4pridc1', 20, filter,
resume)
for user in data:
MySid, string, int = win32security.LookupAccountName('nt4pridc1',
user['name'])
sString = win32security.ConvertSidToStringSid(MySid)
print MySid
print sString
if resume ==0:
break
report()
## sString prints = S-1-5-21-357043131-537017027-1947940980-1289
## MySid prints = PySID:S-1-5-21-357043131-537017027-1947940980-1289
## I need this , I believe this is a hex string of the SID
## 010500000000000515000000BB0B4815C33A022074381B7409050000
.
- Follow-Ups:
- Re: Converting binary sid's to a hex string
- From: Roger Upole
- Re: Converting binary sid's to a hex string
- Prev by Date: Re: Python to C converter
- Next by Date: Re: Very nice python IDE (windows only)
- Previous by thread: printing backslash
- Next by thread: Re: Converting binary sid's to a hex string
- Index(es):
Relevant Pages
|