🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

wazuh-findings-exporter

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wazuh-findings-exporter

Simple script that exports Wazuh Vulnerabilities by Agent groups

pipPyPI
Version
2.0
Maintainers
2

wazuh_findings_exporter

A simple python script which exports findings of a client group from wazuh and adds the agent-ip as well as hostname to every finding for better further processing.

The script may not be perfect, so feel free to provide PRs and help to improve it.

For Wazuh versions below 4.8 it enriches each finding with agent_ip and agent_name.
For Wazuh 4.8+ it queries OpenSearch directly.

Usage

from wazuh_findings_exporter import Wazuh_Importer

WAZUH_URL = "https://wazuh.example.local"
WAZUH_USER = "wazuh-user"
WAZUH_PASS = "wazuh-pass"

# Optional for Wazuh 4.8+ (OpenSearch access)
OS_USER = "opensearch-user"
OS_PASS = "opensearch-pass"
OS_HOST = "opensearch.example.local"
OS_PORT = 9200

EXPORT_DIR = "output"

importer = Wazuh_Importer(
    BASE_URL=WAZUH_URL,
    USERNAME=WAZUH_USER,
    PASSWORD=WAZUH_PASS,
    OPENSEARCH_USERNAME=OS_USER,
    OPENSEARCH_PASSWORD=OS_PASS,
    OPENSEARCH_HOST=OS_HOST,
    OPENSEARCH_PORT=OS_PORT,
    output_mode="split",
    verify=False,
    timeout=30,
)

result = importer.get_findings(
    group="Clients_AAAA",
    filedestination=EXPORT_DIR,
    filename="wazuh.json",
)

print(f"Saved results: {result}")

Parameters

Wazuh_Importer(...) parameters:

ParameterTypeDefaultDescription
BASE_URLstrrequiredBase URL of the Wazuh API, e.g. https://wazuh.example.local:55000.
USERNAMEstrrequiredWazuh API username.
PASSWORDstrrequiredWazuh API password.
OPENSEARCH_USERNAMEstr""OpenSearch username (used for Wazuh 4.8+).
OPENSEARCH_PASSWORDstr""OpenSearch password (used for Wazuh 4.8+).
OPENSEARCH_HOSTstr""OpenSearch host (Wazuh 4.8+).
OPENSEARCH_PORTint9200OpenSearch port (Wazuh 4.8+).
verifyboolFalseVerify TLS certificates for API/OpenSearch calls.
timeoutfloat10Request timeout in seconds.
elasticsearch_indexstrwazuh-states-vulnerabilities-*OpenSearch index pattern for vulnerabilities.
output_modestrsinglesingle writes one file; split writes chunks of 100000 hits per file.
loggerlogging.LoggerNoneCustom logger instance.
disable_insecure_request_warningsboolTrueSuppress insecure HTTPS warnings when verify=False.

get_findings(...) parameters:

ParameterTypeDefaultDescription
groupstrrequiredWazuh group name.
filedestinationstrrequiredDirectory where the JSON output will be saved. Created if missing.
filenamestrwazuh.jsonOutput filename.

How It Works

  • The importer authenticates to the Wazuh API and fetches the API version.
  • Wazuh < 4.8 behavior: script calls /vulnerability/{agent_id} per agent, filters out findings with condition == "Package unfixed", and adds agent_ip and agent_name to each finding.
  • Wazuh >= 4.8 behavior: script queries OpenSearch using the configured credentials and streams results using OpenSearch scrolls.

Output

  • output_mode="single" returns a single Path to the JSON file.
  • output_mode="split" returns a list of Path objects, one per chunk.

Keywords

Wazuh

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts