Skip to main content

AuditPol

GitHub Workflow Status (branch) PyPI GitHub

The auditpol module allows you to easily parse and create Windows Audit Policy CSV files in Python.

Installation

To install the auditpol module via pip, run the command:

$ pip install auditpol

Usage

Start by importing the auditpol module.

>>> import auditpol

The function auditpol.load, loads an audit policy CSV file.

>>> with open('example.csv', 'r') as file:
...     auditpol.load(file)

In addition to loading an existing audit policy, policies created using the relevant subcategory settings, audit options or global object access audit settings can be dumped to a CSV file using the auditpol.dump function.

>>> with open('example.csv', 'w') as file:
...     auditpol.dump(policy, file)

SubcategorySetting

To create a system subcategory setting as part of an audit policy, a auditpol.subcategories.Subcategory and a auditpol.settings.SettingValue must be created.

This can then be used to create a auditpol.settings.SubcategorySetting.

>>> from auditpol.subcategories import Subcategory
>>> from auditpol.settings import SettingValue, SubcategorySetting

>>> subcategory = Subcategory(
...     id='{0CCE922B-69AE-11D9-BED3-505054503030}',
...     name='Process Creation'
... )

>>> inclusion_setting = SettingValue(
...     success=True,
...     failure=True
... )

>>> subcategory_setting = SubcategorySetting(
...     subcategory=subcategory,
...     inclusion_setting=inclusion_setting
... )

AuditOption

To create an audit option as part of an audit policy, a auditpol.settings.OptionValue must be created.

This can then be used to create a auditpol.settings.AuditOption.

>>> from auditpol.settings import OptionValue, AuditOption

>>> value = OptionValue(
...     enabled=True
... )

>>> audit_option = AuditOption(
...     type='CrashOnAuditFail'
...     value=value
... )

GlobalObjectAccessAuditSetting

To create a global object access audit setting, a auditpol.settings.GlobalObjectAccessAuditSetting must be created.

>>> from auditpol.settings import GlobalObjectAccessAuditSetting

>>> global_object_access_audit_setting = GlobalObjectAccessAuditSetting(
...     type='RegistryGlobalSacl'
...     sacl='S:(AU;SA;FA;;;WD)'
... )

AuditPolicy

To create an audit policy one or more subcategory settings, audit options or global object access audit settings must be created as described above.

These settings can then be used to create an auditpol.policy.AuditPolicy.

>>> from auditpol.policy import AuditPolicy

>>> policy = AuditPolicy(
...     settings=[
...         subcategory_setting,
...         audit_option,
...         global_object_access_audit_setting
...     ]
... )

Metadata

Release files for auditpol 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for auditpol 1.1.0
File Size Uploaded
auditpol-1.1.0.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for auditpol 1.1.0
File Interpreter ABI Platform
auditpol-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / auditpol-1.1.0.tar.gz

Download URL auditpol-1.1.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6b09cd8c1c1c8b9c5f4ff37d646375c290fef4bca3a936516f3ba48a175fe5e8
BLAKE2b-256 checksum
How to use checksums
7e2e43b43b3dcc93057d8d7b029081b9cb2dc200cdf5538cc2ec356872451b17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

Release files / auditpol-1.1.0-py3-none-any.whl

Download URL auditpol-1.1.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec2fa09ccd5111590d55d561e16853e6dc06788f179c5874ca9c910d6cab5795
BLAKE2b-256 checksum
How to use checksums
36fccbd6c0708ce96396978d304b7a0ad6c4e81f0a91a598f33951d825be5104
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page