Skip to main content

Parse SDDL strings

Project description

Install

pip3 install sddl_parser

Usage

Parse an SDDL string

>> from sddl_parser import parse_sddl, SDDL, DACL, ACE
>> sddl = "O:SYG:SYD:AI(A;ID;FA;;;SY)"
>> parse_sddl(sddl)

SDDL(
    owner='LOCAL_SYSTEM',
    group='LOCAL_SYSTEM',
    dacl=DACL(
        flags=['SDDL_AUTO_INHERITED'],
        aces=[
            ACE(
                type='ACCESS_ALLOWED',
                flags=['INHERITED'],
                rights=['FILE_ALL'],
                object_guid='',
                inherit_object_guid='',
                sid='LOCAL_SYSTEM',
                conditional_ace=None
            )
        ]
    ), sacl=None)

Parse an ACE

>> from sddl_parser import parse_ace, ACE
>> ace = "(A;ID;0x1200a9;;;AC)"
>> parse_ace(ace)
ACE(
    type="ACCESS_ALLOWED",
    flags=["INHERITED"],
    rights=["FILE_READ", "WRITE_PROPERTY"],
    object_guid="",
    inherit_object_guid="",
    sid="ALL_APP_PACKAGES",
)

TODO

  1. Convert rights and types to enum

Instead of the ACE example, I'd really like to have an enum for all the common properties so that mispellings become a compile time error

ACE(
    type=AceType.ACCESS_ALLOWED,
    flags=[AceFlags.INHERITED],
    ...
)
  1. Allow identifiers (D:, O:, S:) to be out of order. I haven't run into this on any SDDLs on my system, but I'm sure it exists somewhere out there

Thanks

Thanks to An0ther0ne for compiling the constants for ACEs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sddl_parser-0.1.0.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

sddl_parser-0.1.0-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page