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-cliRun the CLI:
./fourcore-cli [command] [flags]--api-key, -kAPI Key for authentication (can also useFOURCORE_API_KEYenv var)--base-url, -uBase URL for the API (can also useFOURCORE_BASE_URLenv var)
assetManage assets (list, get, enable, disable, delete, tags, analytics, attacks, executions, packs)agent logList agent logs with filtering and formatting optionsauditList audit logsconfigView 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 viewConfiguration 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.ioOr by setting environment variables:
FOURCORE_API_KEYFOURCORE_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.