Skip to content

Instantly share code, notes, and snippets.

View Kucharskov's full-sized avatar

Michał Kucharski Kucharskov

View GitHub Profile
@Kucharskov
Kucharskov / sid2hex.py
Created March 10, 2020 11:07
Script which converts SID (domain/user) to HEX format. Eg "S-1-5-21-3167813660-1240564177-918740779-0" becomes "0105000000000005150000001C00D1BCD181F1492BDFC23606040000"
#!/usr/bin/env python
# Created by: M. Kucharskov (https://kucharskov.pl)
import struct
def convert(sid):
# Remove "S-"
sid = sid.replace("S-", "")
# Split values
data = sid.split("-")
# Declare output