Skip to main content

Captures Sysmon events and converts the output into a pandas DataFrames / CSV

pip install sysmon2df

Tested against Windows 10 / Python 3.10 / Anaconda

The function start_observing prepares for the observation by uninstalling any existing Sysmon installation and removing the old event log file (if specified). It installs Sysmon using the provided or default configuration XML (capture every event). It starts an infinite loop where it sleeps for 1 second until a keyboard interrupt is received. After the observation is stopped, it copies the Sysmon event log (EVTX file) to the specified or temporary output path. It uninstalls Sysmon again to clean up. It generates a pandas DataFrame from the Sysmon event log using the dataframe_from_evtx function. If specified, it saves the DataFrame as a CSV file at the specified path. Finally, it returns the DataFrame.

How to use it:

start_observing(
    uninstall: int | bool = 1,
    uninstall_force: int | bool = 1,
    evtx_path: str | None = None,
    remove_old_evtx: int | bool = 1,
    configxml: str | None = None,
    evtx_output_path: str | None = None,
    csv_output_path: str | None = None,
) -> pd.DataFrame:
    r"""
    Starts observing system events using Sysmon and returns a pandas DataFrame containing the recorded events.

    Args:
        uninstall (int | bool, optional): Flag indicating whether to uninstall Sysmon after/before observation. Defaults to 1.
        uninstall_force (int | bool, optional): Flag indicating whether to force uninstall Sysmon. Defaults to 1.
        evtx_path (str | None, optional): Path to the Sysmon event log (EVTX file). If not provided, the default path ("System32\Winevt\Logs\Microsoft-Windows-Sysmon%4Operational.evtx") will be used. Defaults to None.
        remove_old_evtx (int | bool, optional): Flag indicating whether to remove the existing Sysmon event log before starting observation. Defaults to 1.
        configxml (str | None, optional): Path to the Sysmon configuration XML file. If not provided, a temporary file will be created. Defaults to None.
        evtx_output_path (str | None, optional): Path to save the Sysmon event log (EVTX file) after observation. If not provided, a temporary file will be created. Defaults to None.
        csv_output_path (str | None, optional): Path to save the recorded events as a CSV file. If not provided, no CSV file will be created. Defaults to None.

    Returns:
        pd.DataFrame: A pandas DataFrame containing the recorded system events.

        Example of CSV output:
        ,aa_value,aa_key_0,aa_key_1,aa_key_2,aa_key_3,aa_key_4,aa_event_record_id,aa_timestamp,aa_kind_of_event
        0,http://schemas.microsoft.com/win/2004/08/events/event,Event,#attributes,xmlns,,,32,2023-05-18 14:11:16.815117+00:00,
        1,C:\Windows\SYSTEM32\ntdll.dll+9d364|C:\Windows\system32\basesrv.DLL+2fba|C:\Windows\SYSTEM32\CSRSRV.dll+5af4|C:\Windows\SYSTEM32\ntdll.dll+6d72f,Event,EventData,CallTrace,,,32,2023-05-18 14:11:16.815117+00:00,
        2,0x1fffff,Event,EventData,GrantedAccess,,,32,2023-05-18 14:11:16.815117+00:00,
        3,-,Event,EventData,RuleName,,,32,2023-05-18 14:11:16.815117+00:00,
        4,C:\Windows\system32\csrss.exe,Event,EventData,SourceImage,,,32,2023-05-18 14:11:16.815117+00:00,
        

from sysmon2df import start_observing  
df = start_observing(
    uninstall=True,
    uninstall_force=True,
    evtx_path=None,
    remove_old_evtx=True,
    configxml=None,
    evtx_output_path="c:\\backupsysmon2.evtx",
    csv_output_path="c:\\backupsysmon2.csv",
)
        

Metadata

Release files for sysmon2df 0.10

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

Source distribution (sdist)

Source distribution for sysmon2df 0.10
File Size Uploaded Provenance Actions
sysmon2df-0.10.tar.gz 4.8 MB Without provenance Details for sysmon2df-0.10.tar.gz

Built distribution (wheel)

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

Total release size: 9.6 MB

Release files / sysmon2df-0.10.tar.gz

Download URL sysmon2df-0.10.tar.gz
Size 4.8 MB
Tags Source
SHA-256 checksum
How to use checksums
a995bfb37d579d7b07fc496c821a412509d5153fdc78842c728aa769eb6dd630
BLAKE2b-256 checksum
How to use checksums
2194cfb4b3e00b97a222300a3961481b558cb2bd60fbb42a2c1a65d73dfb6f10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / sysmon2df-0.10-py3-none-any.whl

Download URL sysmon2df-0.10-py3-none-any.whl
Size 4.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d1798960a66da4db4b88bdfcee1a87be817e1f34aa52d33bd5f4d4a693bcf160
BLAKE2b-256 checksum
How to use checksums
9ec64a85977b1e684c282a67a8142e0c651fe935f39e652d3c5c4c20fc2b3811
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for sysmon2df 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

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