SDK and CLI for FourCore ATTACK REST API
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.
- 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.
- Go 1.18 or higher
git clone https://github.com/fourcorelabs/attack-sdk-go.git
cd attack-sdk-go/cmd/cli
go build -o fourcore-cli
Run the CLI:
./fourcore-cli [command] [flags]
--api-key, -k
API Key for authentication (can also useFOURCORE_API_KEY
env var)--base-url, -u
Base URL for the API (can also useFOURCORE_BASE_URL
env var)
asset
Manage assets (list, get, enable, disable, delete, tags, analytics, attacks, executions, packs)agent log
List agent logs with filtering and formatting optionsaudit
List audit logsconfig
View and set CLI configuration
./fourcore-cli asset list --format table
./fourcore-cli agent log list --size 20 --order ASC --format json
./fourcore-cli config set api-key <your-api-key>
./fourcore-cli config view
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
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"
baseURL := os.Getenv("FOURCOREBASEURL")
client, err := api.NewHTTPAPI(baseURL, "<your-api-key>")
assets, err := asset.GetAssets(client)
- Main CLI entrypoint: cmd/cli/main.go
- CLI commands: cmd/cli/cmd/
- SDK packages: pkg/
- Configuration: pkg/config/config.go
See LICENSE.md.
Pull requests and issues are welcome!
For support, contact FourCore Labs.