Skip to main content

Utility functions for AttackIQ Platform API usage

Project description

AttackIQ Platform API

⚠️ BETA / WORK IN PROGRESS ⚠️

Tools for interacting with the AttackIQ Platform API:

  • Python SDK (aiq-platform-api) - Library for Python applications
  • CLI (aiq) - Command-line interface

Status

This project is currently in beta and under active development. Features and APIs may change without notice. Feedback and contributions are welcome!


Python SDK

Install from PyPI:

pip install aiq-platform-api

Usage

from aiq_platform_api.core import AttackIQRestClient, ScenarioUtils

client = AttackIQRestClient(
    "https://your-platform.attackiq.com",
    "your-api-token"
)

# Search scenarios
result = ScenarioUtils.search_scenarios(client, query="powershell", limit=10)
print(f"Found {result['count']} scenarios")

# List assets
for asset in AssetUtils.get_assets(client, limit=5):
    print(asset["hostname"])

Environment Variables

export ATTACKIQ_PLATFORM_URL="https://your-platform-url.attackiq.com"
export ATTACKIQ_PLATFORM_API_TOKEN="your-api-token"

CLI

Quick Install (Recommended)

Public repo:

curl -sSL https://raw.githubusercontent.com/AttackIQ/aiq-platform-api/main/install.sh | bash

Private repo (with token):

GITHUB_TOKEN="your_token_here" bash -c \
  'curl -sSL -H "Authorization: Bearer $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw" \
   https://api.github.com/repos/AttackIQ/aiq-platform-api/contents/install.sh | bash'

This auto-detects your OS and architecture, downloads the latest release, and installs to /usr/local/bin.

To create a token: GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate with Contents: Read-only permission for this repo.

Manual Download

Download the appropriate binary for your system from GitHub Releases:

OS Architecture Download
Linux x86_64 aiq_*_linux_amd64.tar.gz
Linux ARM64 aiq_*_linux_arm64.tar.gz
macOS Intel aiq_*_darwin_amd64.tar.gz
macOS Apple Silicon aiq_*_darwin_arm64.tar.gz
Windows x86_64 aiq_*_windows_amd64.zip
Windows ARM64 aiq_*_windows_arm64.zip

Linux/macOS:

# Download (replace URL with your OS/arch)
curl -LO https://github.com/AttackIQ/aiq-platform-api/releases/latest/download/aiq_VERSION_linux_amd64.tar.gz

# Extract
tar xzf aiq_*.tar.gz

# Move to PATH
sudo mv aiq /usr/local/bin/

# Verify
aiq --version

Windows (PowerShell):

# Download
Invoke-WebRequest -Uri "https://github.com/AttackIQ/aiq-platform-api/releases/latest/download/aiq_VERSION_windows_amd64.zip" -OutFile aiq.zip

# Extract
Expand-Archive aiq.zip -DestinationPath .

# Add to PATH or move to a directory in PATH

Build from Source

Requires Go 1.22+:

go build -o aiq ./cmd/aiq

Install via Go

go install github.com/attackiq/aiq-cli/cmd/aiq@latest

Usage

# List available commands
aiq --help

# List assessments
aiq assessments list

# Search assets
aiq assets search --query "hostname"

# Get scenario details
aiq scenarios get --scenario-id "abc123"

Shell Completion

The CLI supports shell completion for bash, zsh, fish, and PowerShell.

Bash

Current session:

source <(aiq completion bash)

Permanent installation:

# Linux
aiq completion bash | sudo tee /etc/bash_completion.d/aiq

# macOS
aiq completion bash > $(brew --prefix)/etc/bash_completion.d/aiq

Zsh

Current session:

source <(aiq completion zsh)

Permanent installation:

# Add to ~/.zshrc
echo "source <(aiq completion zsh)" >> ~/.zshrc

# Or install to completions directory
aiq completion zsh > "${fpath[1]}/_aiq"

Fish

Permanent installation:

aiq completion fish | source

# Or save to completions directory
aiq completion fish > ~/.config/fish/completions/aiq.fish

PowerShell

Current session:

aiq completion powershell | Out-String | Invoke-Expression

Permanent installation: Add the following to your PowerShell profile:

aiq completion powershell | Out-String | Invoke-Expression

Contributing

We welcome feedback and contributions! For detailed contribution guidelines, please see CONTRIBUTING.md.

Quick ways to contribute:

  • Open issues for bugs or feature requests
  • Submit pull requests
  • Provide feedback on the API design

License

MIT License - See LICENSE file for details

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiq_platform_api-0.2.42.tar.gz (55.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiq_platform_api-0.2.42-py3-none-any.whl (65.2 kB view details)

Uploaded Python 3

File details

Details for the file aiq_platform_api-0.2.42.tar.gz.

File metadata

  • Download URL: aiq_platform_api-0.2.42.tar.gz
  • Upload date:
  • Size: 55.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.8 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for aiq_platform_api-0.2.42.tar.gz
Algorithm Hash digest
SHA256 2f7b91a17d2c027044d68642a81a190c1d78900bb4d58b09da170cd9794362cf
MD5 57bf90a911021d8445d336bd9b4e6a94
BLAKE2b-256 a7b4b622e43f19b65f969d1a3ea1b21b550dca38082802c520a918a61d06af95

See more details on using hashes here.

File details

Details for the file aiq_platform_api-0.2.42-py3-none-any.whl.

File metadata

  • Download URL: aiq_platform_api-0.2.42-py3-none-any.whl
  • Upload date:
  • Size: 65.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.8 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for aiq_platform_api-0.2.42-py3-none-any.whl
Algorithm Hash digest
SHA256 546c40923bed66be2a89565e98d94499de116f994abb3047db27dbaf1c32fb77
MD5 37ad921a33e06f5098f30f0fc4e37363
BLAKE2b-256 c424e0176e4d76bdf7ad4efe7607a3882003863fb9f487432c648501ba7a0897

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page