mrtc0 / wazuh

Wazuh REST API in Go

Home Page:https://godoc.org/github.com/mrtc0/wazuh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wazuh API in Go

Build Status


Wazuh REST API library

https://documentation.wazuh.com/current/user-manual/api/reference.html

Install

$ go get -u github.com/mrtc0/wazuh

Usage

package main

import (
	"flag"
	"fmt"
	"os"

	"github.com/mrtc0/wazuh"
)

func main() {
	flag.Parse()
	args := flag.Args()

	endpoint := args[0]
	user := args[1]
	pass := args[2]

	client, err := wazuh.New(endpoint, wazuh.WithBasicAuth(user, pass))

	agents, err := client.GetAllAgents()
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	fmt.Printf("%-20v%-20v\n", "ID", "NAME")
	for _, agent := range *agents {
		if agent.Status == "Active" {
			fmt.Printf("%-20v%-20v\n", agent.ID, agent.Name)
		}
	}
}

see example

Contributing

You are more than welcome to contribute to this project.
Fork and make a Pull Request, or create an Issue if you see any problem.

About

Wazuh REST API in Go

https://godoc.org/github.com/mrtc0/wazuh

License:Apache License 2.0


Languages

Language:Go 99.9%Language:Makefile 0.1%