Created
December 20, 2018 10:58
-
-
Save ilyaglow/be05adf551f7144d516c0e1e3cb31337 to your computer and use it in GitHub Desktop.
Convert userAccountControl code to the user account property flags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROPERTY_FLAGS = [ | |
"SCRIPT", | |
"ACCOUNTDISABLE", | |
None, | |
"HOMEDIR_REQUIRED", | |
"LOCKOUT", | |
"PASSWD_NOTREQD", | |
"PASSWD_CANT_CHANGE", | |
"ENCRYPTED_TEXT_PWD_ALLOWED", | |
"TEMP_DUPLICATE_ACCOUNT", | |
"NORMAL_ACCOUNT", | |
None, | |
"INTERDOMAIN_TRUST_ACCOUNT", | |
"WORKSTATION_TRUST_ACCOUNT", | |
"SERVER_TRUST_ACCOUNT", | |
None, | |
None, | |
"DONT_EXPIRE_PASSWORD", | |
"MNS_LOGON_ACCOUNT", | |
"SMARTCARD_REQUIRED", | |
"TRUSTED_FOR_DELEGATION", | |
"NOT_DELEGATED", | |
"USE_DES_KEY_ONLY", | |
"DONT_REQ_PREAUTH", | |
"PASSWORD_EXPIRED", | |
"TRUSTED_TO_AUTH_FOR_DELEGATION", | |
None, | |
"PARTIAL_SECRETS_ACCOUNT", | |
] | |
def uac_decode(n): | |
props = [] | |
if n < 1: | |
return props | |
for i in range(len(PROPERTY_FLAGS)): | |
if (n & 2**i) == 0: | |
continue | |
props.append(PROPERTY_FLAGS[i]) | |
return props |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment