Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ options:
--colors print with colors
```

The `value` argument accepts any standard Python integer literal: decimal (`512`), hexadecimal (`0x200`), binary (`0b1000000000`), or octal (`0o1000`).

## Contributing

Pull requests are welcome. Feel free to open an issue if you want to add other features.
8 changes: 6 additions & 2 deletions msFlagsDecoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ def parseArgs():
if __name__ == '__main__':
options = parseArgs()

try:
options.value = int(options.value, 0)
except ValueError:
print("[!] Invalid value %r: expected an integer (decimal, 0x… hex, 0b… binary, or 0o… octal)" % options.value)
exit(1)

if options.attribute.lower() == "userAccountControl".lower():
bits = 32
options.value = int(options.value)
if options.bits == True:
print("[>] %-30s : %s" % ("userAccountControl value", bin(options.value)[2:].rjust(bits, '0').replace('0', '.')))
else:
Expand Down Expand Up @@ -119,7 +124,6 @@ def parseArgs():

elif options.attribute.lower() == "sAMAccountType".lower():
bits = 32
options.value = int(options.value)
if options.bits == True:
print("[>] %-25s : %s" % ("sAMAccountType value", bin(options.value)[2:].rjust(bits, '0').replace('0', '.')))
else:
Expand Down