#!/usr/bin/env ruby
puts "\n"
if ARGV[0] == nil
	puts "UAC number is required"
	exit
end

uac = ARGV[0]
# uac = 4130
uacbin = uac.to_i.to_s(2)

# Resource data - http://www.selfadsi.org/ads-attributes/user-userAccountControl.htm

uacoptions = [
"Reserved, the value must always be 0",
"UF_ACCOUNT_DISABLE",
"Reserved, the value must always be 0",
"UF_HOMEDIR_REQUIRED",
"UF_LOCKOUT",
"UF_PASSWD_NOTREQD",
"UF_PASSWD_CANT_CHANGE",
"UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED",
"Reserved, the value must always be 0",
"UF_NORMAL_ACCOUNT",
"Reserved, the value must always be 0",
"UF_INTERDOMAIN_TRUST_ACCOUNT",
"UF_WORKSTATION_TRUST_ACCOUNT",
"UF_SERVER_TRUST_ACCOUNT",
"Reserved, the value must always be 0",
"Reserved, the value must always be 0",
"UF_DONT_EXPIRE_PASSWD",
"UF_MNS_LOGON_ACCOUNT",
"UF_SMARTCARD_REQUIRED",
"UF_TRUSTED_FOR_DELEGATION",
"UF_NOT_DELEGATED",
"UF_USE_DES_KEY_ONLY",
"UF_DONT_REQUIRE_PREAUTH",
"UF_PASSWORD_EXPIRED",
"UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION",
"UF_NO_AUTH_DATA_REQUIRED",
"UF_PARTIAL_SECRETS_ACCOUNT"
]

=begin

Flag value (binary)	(decimal)	 
0000000000000000000000000000000x	1 	 Reserved, the value must always be 0
00000000000000000000000000000010	2 	 UF_ACCOUNT_DISABLE
00000000000000000000000000000x00	4 	  Reserved, the value must always be 0
00000000000000000000000000001000	8 	 UF_HOMEDIR_REQUIRED
00000000000000000000000000010000	16 	 UF_LOCKOUT
00000000000000000000000000100000	32 	 UF_PASSWD_NOTREQD
00000000000000000000000001000000	64 	 UF_PASSWD_CANT_CHANGE
00000000000000000000000010000000	128 	 UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED
00000000000000000000000x00000000	256 	 Reserved, the value must always be 0
00000000000000000000001000000000	512 	 UF_NORMAL_ACCOUNT
000000000000000000000x0000000000	1024 	 Reserved, the value must always be 0
00000000000000000000100000000000	2048 	 UF_INTERDOMAIN_TRUST_ACCOUNT
00000000000000000001000000000000	4096 	 UF_WORKSTATION_TRUST_ACCOUNT
00000000000000000010000000000000	8192 	UF_SERVER_TRUST_ACCOUNT
00000000000000000x00000000000000	16384 	 Reserved, the value must always be 0
0000000000000000x000000000000000	32768 	 Reserved, the value must always be 0
00000000000000010000000000000000	65536 	 UF_DONT_EXPIRE_PASSWD
00000000000000100000000000000000	131072 	 UF_MNS_LOGON_ACCOUNT
00000000000001000000000000000000	262144 	 UF_SMARTCARD_REQUIRED
00000000000010000000000000000000	524288 	 UF_TRUSTED_FOR_DELEGATION
00000000000100000000000000000000	1048576 	 UF_NOT_DELEGATED
00000000001000000000000000000000	2097152 	 UF_USE_DES_KEY_ONLY
00000000010000000000000000000000	4194304 	 UF_DONT_REQUIRE_PREAUTH
00000000100000000000000000000000	8388608 	 UF_PASSWORD_EXPIRED
00000001000000000000000000000000	16777216 	 UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION
00000010000000000000000000000000	33554432 	 UF_NO_AUTH_DATA_REQUIRED
00000100000000000000000000000000	67108864 	 UF_PARTIAL_SECRETS_ACCOUNT	
	
=end


puts uacbin.reverse
uacbin.reverse.each_char.with_index do |char, i|
	if char == "0"
		next
	end
	puts uacoptions[i]
end
