htb-cli 0.1.0

Hack The Box CLI
htb-cli-0.1.0 is not a library.

htb-cli

A terminal client for Hack The Box. Browse machines, challenges, Sherlocks, and seasons. Spawn instances, submit flags, manage VPN connections.

Works with any HTB account (free or VIP).

Install

cargo install htb-cli

Or download a binary from releases.

Setup

# Save your API token (from https://app.hackthebox.com/profile/settings)
htb auth login

# Verify it works
htb auth status

Usage

# Machines
htb machines list --os linux --difficulty easy
htb machines info Bedside
htb machines start Bedside
htb machines submit Bedside 'HTB{flag_here}'
htb machines active

# Challenges
htb challenges list --category Web
htb challenges categories
htb challenges info Poly
htb challenges start Poly
htb challenges submit 112 'HTB{flag_here}'
htb challenges download Poly

# Sherlocks
htb sherlocks list --category DFIR
htb sherlocks info Brutus

# Seasons
htb seasons list
htb seasons rank

# VPN
htb vpn status
htb vpn list
htb vpn switch 1
htb vpn download

# User
htb user me
htb user info 1234567

# Search
htb search nmap

Output

Table output by default. Use --json on any command for machine-readable output:

htb machines list --json
htb auth status --json

MCP Server

Run as an MCP server for AI agent integration:

htb --mcp-stdio

Exposes tools: list_machines, get_machine_info, list_challenges, get_challenge_info, start_challenge, submit_challenge_flag, get_active_machine, list_seasons, search, get_user_profile.

Claude Code config

{
  "mcpServers": {
    "htb": {
      "command": "htb",
      "args": ["--mcp-stdio"]
    }
  }
}

Config

Optional config at ~/.htb-cli/config.toml:

output = "table"   # or "json"
vpn_server = 1     # default VPN server ID
no_color = false

Token stored at ~/.htb-cli/.token (0600 permissions).

License

MIT