Registry / security / winacl

winacl

JSON →
library0.1.9pypypi✓ verified 81d ago

A pure Python library for manipulating Windows ACLs, ACEs, and Security Descriptors. Provides classes for parsing and constructing security descriptors, access control entries (ACEs), and access control lists (ACLs). Current version is 0.1.9, released on PyPI. The library is actively maintained with no breaking changes reported between versions.

pip install winacl
INSTALL
IMPORT
SIG · WINACL
W
winacl
securitypythonv0.1.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SID
import winacl
from winacl import SID

Creates a security descriptor, adds an ACE allowing Everyone (S-1-1-0) generic access, and prints the textual representation.

from winacl import SecurityDescriptor, SID, ACE, ACESidFlags, ACEType, ACEOleFlags, ACL sd = SecurityDescriptor() sd.set_owner(SID('S-1-5-32-544')) sd.set_group(SID('S-1-5-32-544')) ace = ACE() ace.AceType = ACEType.ACCESS_ALLOWED_ACE_TYPE ace.set_sid(SID('S-1-1-0')) ace.AceFlags = ACESidFlags.CONTAINER_INHERIT_ACE | ACESidFlags.OBJECT_INHERIT_ACE ace.Mask = 0x1 acl = ACL() acl.aces.append(ace) sd.set_dacl(acl) print(sd.to_text())
Debug
Known issues
gotchaDo not import from submodules like `winacl.dtyp.security_descriptor` directly; the top-level `from winacl import SecurityDescriptor` is the public API. Internal structure may change.
fix
Use from winacl import SecurityDescriptor
affects: all
gotchaThe library uses an in-memory representation of ACLs; changes made after converting to bytes or text are not reflected unless you reassign.
fix
Always call sd.get_bytes() or to_text() after final modifications.
affects: all
deprecatedSome attribute names like AceFlags vs. AceType are case-sensitive and may differ from older documentation. Use the enumerations provided (e.g., ACEType.ACCESS_ALLOWED_ACE_TYPE) instead of hardcoded integers.
fix
Check the class definition for correct attribute names.
affects: >=0.1.0
Upgrade
Version history
0.1.9latest on PyPI · released May 6, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
37 hits · last 30 days
node
32
Resources
winacl — pip install winacl · libregistry