attack-sdk-go

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2025 License: MIT

README

attack-sdk-go

SDK and CLI for FourCore ATTACK REST API

Overview

attack-sdk-go provides both a Go SDK and a CLI tool to interact with the FourCore ATTACK REST API. It enables management and retrieval of resources such as assets, agent logs, and audit logs.


Features

  • CLI Tool: Manage assets, agent logs, audit logs, and configuration from the command line.
  • Go SDK: Programmatic access to FourCore API endpoints.
  • Configurable: Supports configuration via file, environment variables, and command-line flags.
  • Pagination, Filtering, and Formatting: Flexible output and query options for logs and assets.

Installation

Prerequisites
  • Go 1.18 or higher
Build CLI
git clone https://github.com/fourcorelabs/attack-sdk-go.git
cd attack-sdk-go/cmd/cli
go build -o fourcore-cli

Usage

CLI

Run the CLI:

./fourcore-cli [command] [flags]
Global Flags
  • --api-key, -k API Key for authentication (can also use FOURCORE_API_KEY env var)
  • --base-url, -u Base URL for the API (can also use FOURCORE_BASE_URL env var)
Commands
  • asset             Manage assets (list, get, enable, disable, delete, tags, analytics, attacks, executions, packs)
  • agent log       List agent logs with filtering and formatting options
  • audit             List audit logs
  • config            View and set CLI configuration
Example: List Assets
./fourcore-cli asset list --format table
Example: Get Agent Logs
./fourcore-cli agent log list --size 20 --order ASC --format json
Example: Set API Key
./fourcore-cli config set api-key <your-api-key>
Example: View Current Config
./fourcore-cli config view

Configuration

Configuration is stored in a JSON file at:

  • Linux/macOS: ~/.fourcore/config.json
  • Windows: %USERPROFILE%\.fourcore\config.json

You can set values using the CLI:

./fourcore-cli config set api-key <your-api-key>
./fourcore-cli config set base-url https://prod.fourcore.io

Or by setting environment variables:

  • FOURCORE_API_KEY
  • FOURCORE_BASE_URL

Go SDK Usage

Import the SDK in your Go project:

import "github.com/fourcorelabs/attack-sdk-go/pkg/api"
import "github.com/fourcorelabs/attack-sdk-go/pkg/asset"
Example: List Assets
baseURL := os.Getenv("FOURCOREBASEURL")
client, err := api.NewHTTPAPI(baseURL, "<your-api-key>")
assets, err := asset.GetAssets(client)

Development


License

See LICENSE.md.


Contributing

Pull requests and issues are welcome!


Support

For support, contact FourCore Labs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL