Skip to main content

Python Library for the Wazuh API

Project description

Pyzuh

Pyzuh is a python library for the Wazuh API. Inspired by Spotipy, Pyzuh's intend is to allow for easier use of the Wazuh API for tasks that range from adding agents to running logtests. I recommend that you read the Wazuh API for more under the hood and to familarize yourself with all the features.

This can be found here: https://documentation.wazuh.com/current/user-manual/api/reference.html#section/Authentication

Note: This library is written based on the current version at the time (Version 4.7). This sunsets the vulnerability section on the API.

How does Pyzuh work?

Wazuh (and thus Pyzuh) uses jwt to make requests. Each request has 2-4 parts: header, body (if needed), parameters, and json (also if needed). Each function has a docstring you can view to get a better idea of what you will need to change for your specific needs.

For example:

from pyzuh import lists

help(lists.get_cdb_lists_files) # This will print the docstring for get_cdb_lists_files

The docstring for each function will help navigate what you want to change or state what will be required to fill into your requests for your own projects.

Installation

pip install pyzuh

For Windows Users:

py -m pip install pyzuh

Examples

I have included an examples folder where you can use some basic ideas as a starting point or use the code for your own SOC deployments. Here is a basic example of a project idea where you run a scan and it post to a slack channel:

from pyzuh import Agents
import json

def run_scan_and_post_to_slack(wazuh_client, slack_webhook_url):
    # Run system scan on all agents
    response = wazuh_client.run_sysscan(pretty=True, wait_for_complete=True)

    # Post response to Slack channel
    slack_message = {
        "text": "Wazuh system scan completed",
        "attachments": [
            {
                "text": json.dumps(response, indent=4)
            }
        ]
    }
    requests.post(slack_webhook_url, json=slack_message)

if __name__ == "__main__":
    # Initialize the Wazuh client
    wazuh_client = Agents(api_url='your-wazuh-api-url', jwt_token='your-wazuh-jwt-token')

    # Define your Slack webhook URL
    slack_webhook_url = 'your-slack-webhook-url'

    # Run system scan and post results to Slack
    run_scan_and_post_to_slack(wazuh_client, slack_webhook_url)

Questions/Issues

If you have run into any issues, file an issue or email me at austin@liliumsecurity.com.

FAQ can be found here: FAQ

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

pyzuh-1.0.0.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyzuh-1.0.0-py3-none-any.whl (44.6 kB view details)

Uploaded Python 3

File details

Details for the file pyzuh-1.0.0.tar.gz.

File metadata

  • Download URL: pyzuh-1.0.0.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for pyzuh-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fa039885884ad4783b76f2e663b150994a3d13c1ff32cc1e729fc903590e6335
MD5 fead23a32786491f69fc77c047414b0a
BLAKE2b-256 74fdc465c219012fc59f52b850bb7c36baeac27bf1bbe43a996817b291f983d1

See more details on using hashes here.

File details

Details for the file pyzuh-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyzuh-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 44.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for pyzuh-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a2253b26f93744e92f5713ae675bf0f29dcd91d016922e812ed4eb663446d0c
MD5 c4438e903a5dbfdfaea41b5b1852fdcf
BLAKE2b-256 7f85070c3551b8a78883680e825b1ccd1303c956102ad9b43b9ef15c5dbbfa2d

See more details on using hashes here.

Supported by

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