# SDDL

## Usage

```bash
$ sddl -h
usage: sddl [-h] [--type TYPE] [--list-types] [--json] [sddl]

Read SDDL strings

positional arguments:
  sddl          SDDL string to parse. If not provided, read from stdin.

options:
  -h, --help    show this help message and exit
  --type TYPE   Type of ACE to parse. Default: GenericAccessRights
  --list-types  List available ACE types
  --json        Output as JSON

Example: `sddl 'O:BAG:BAD:(A;;GA;;;WD)'` or `echo 'O:BAG:BAD:(A;;GA;;;WD)' | sddl`
```

## Examples

- Using an alternative rights type

```bash
sddl 'O:SYG:SYD:AI(A;ID;FA;;;SY)(A;ID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;ID;0x1200a9;;;AC)(A;ID;0x1200a9;;;
S-1-15-2-2)' --type RegistryKeyAccessRights
Owner: LOCAL_SYSTEM
Group: LOCAL_SYSTEM
DACL:
  SDDL_AUTO_INHERITED
    ACCESS_ALLOWED INHERITED KEY_CREATE_LINK|KEY_QUERY_VALUE|KEY_SET_VALUE|KEY_WOW64_64KEY|KEY_CREATE_SUB_KEY|DELETE|READ_CONTROL|WRITE_DAC|KEY_ENUMERATE_SUB_KEYS|WRITE_OWNER|SYNCHRONIZE|KEY_WRITE|KEY_NOTIFY|KEY_READ|KEY_ALL_ACCESS LOCAL_SYSTEM
    ACCESS_ALLOWED INHERITED KEY_CREATE_LINK|KEY_QUERY_VALUE|KEY_SET_VALUE|KEY_WOW64_64KEY|KEY_CREATE_SUB_KEY|DELETE|READ_CONTROL|WRITE_DAC|KEY_ENUMERATE_SUB_KEYS|WRITE_OWNER|SYNCHRONIZE|KEY_WRITE|KEY_NOTIFY|KEY_READ|KEY_ALL_ACCESS BUILTIN_ADMINISTRATORS
    ACCESS_ALLOWED INHERITED KEY_CREATE_LINK|KEY_QUERY_VALUE|READ_CONTROL|SYNCHRONIZE|KEY_ENUMERATE_SUB_KEYS BUILTIN_USERS
    ACCESS_ALLOWED INHERITED KEY_CREATE_LINK|KEY_QUERY_VALUE|READ_CONTROL|SYNCHRONIZE|KEY_ENUMERATE_SUB_KEYS ALL_APP_PACKAGES
    ACCESS_ALLOWED INHERITED KEY_CREATE_LINK|KEY_QUERY_VALUE|READ_CONTROL|SYNCHRONIZE|KEY_ENUMERATE_SUB_KEYS S-1-15-2-2
SACL:
```

- Output to JSON

```bash
$ sddl 'O:SYG:SYD:AI(A;ID;FA;;;SY)(A;ID;FA;;;BA)(A;ID;0x1200a9;;;BU)(A;ID;0x1200a9;;;AC)(A;ID;0x1200a9;;;
S-1-15-2-2)' --type RegistryKeyAccessRights --json
{"owner": "LOCAL_SYSTEM", "group": "LOCAL_SYSTEM", "dacl": {"flags": ["SDDL_AUTO_INHERITED"], "aces": [{"type": "ACCESS_ALLOWED", "flags": ["INHERITED"], "rights": ["KEY_CREATE_LINK", "KEY_QUERY_VALUE", "KEY_SET_VALUE", "KEY_WOW64_64KEY", "KEY_CREATE_SUB_KEY", "DELETE", "READ_CONTROL", "WRITE_DAC", "KEY_ENUMERATE_SUB_KEYS", "WRITE_OWNER", "SYNCHRONIZE", "KEY_WRITE", "KEY_NOTIFY", "KEY_READ", "KEY_ALL_ACCESS"], "sid": "LOCAL_SYSTEM"}, {"type": "ACCESS_ALLOWED", "flags": ["INHERITED"], "rights": ["KEY_CREATE_LINK", "KEY_QUERY_VALUE", "KEY_SET_VALUE", "KEY_WOW64_64KEY", "KEY_CREATE_SUB_KEY", "DELETE", "READ_CONTROL", "WRITE_DAC", "KEY_ENUMERATE_SUB_KEYS", "WRITE_OWNER", "SYNCHRONIZE", "KEY_WRITE", "KEY_NOTIFY", "KEY_READ", "KEY_ALL_ACCESS"], "sid": "BUILTIN_ADMINISTRATORS"}, {"type": "ACCESS_ALLOWED", "flags": ["INHERITED"], "rights": ["KEY_CREATE_LINK", "KEY_QUERY_VALUE", "READ_CONTROL", "SYNCHRONIZE", "KEY_ENUMERATE_SUB_KEYS"], "sid": "BUILTIN_USERS"}, {"type": "ACCESS_ALLOWED", "flags": ["INHERITED"], "rights": ["KEY_CREATE_LINK", "KEY_QUERY_VALUE", "READ_CONTROL", "SYNCHRONIZE", "KEY_ENUMERATE_SUB_KEYS"], "sid": "ALL_APP_PACKAGES"}, {"type": "ACCESS_ALLOWED", "flags": ["INHERITED"], "rights": ["KEY_CREATE_LINK", "KEY_QUERY_VALUE", "READ_CONTROL", "SYNCHRONIZE", "KEY_ENUMERATE_SUB_KEYS"], "sid": "S-1-15-2-2"}]}, "sacl": null}
```
