Skip to main content

Clean, modular CLI for Hack The Box Labs API

Project description

HTB CLI

A clean, modular command-line interface for the Hack The Box Labs API.

Features

  • Machines: List, spawn (by name!), stop, reset, submit flags, todo list, writeups
  • Challenges: Browse, start docker containers, download files, submit flags
  • Sherlocks: DFIR investigation challenges with multi-task support
  • VPN: Manage VPN connections and download configs
  • Seasons: Arena/competitive season support
  • Search: Global search across machines, challenges, and users

Installation

pipx install htb-terminal

Setup

Get your API token from HTB App Token Settings.

# Option 1: Environment variable
export HTB_TOKEN='your-token-here'  # add to ~/.bashrc to persist

# Option 2: Token file
echo 'your-token-here' > ~/.htb-token
chmod 600 ~/.htb-token

Usage

# Quick status
htb status
htb whoami
htb search "linux"

# Machines (supports name or ID!)
htb machine list
htb machine list --retired
htb machine list --difficulty easy
htb machine list --sort name
htb machine list --search "gavel"
htb machine info Gavel
htb machine info 811
htb machine spawn Gavel              # By name
htb machine spawn 811                # By ID
htb machine active
htb machine stop
htb machine reset
htb machine own 'flag'
htb machine unreleased
htb machine todo                     # Your todo list
htb machine add-todo Gavel           # Toggle todo (add/remove)
htb machine writeup Gavel            # Official writeup (VIP)

# Challenges
htb challenge list
htb challenge list --category web
htb challenge list --difficulty easy
htb challenge list --category forensics --difficulty easy --unsolved
htb challenge list --retired
htb challenge categories
htb challenge info "Reminiscent"
htb challenge active                 # Show running docker instance
htb challenge start "Reminiscent"
htb challenge stop "Reminiscent"
htb challenge download "Reminiscent"
htb challenge own 'HTB{flag}' --challenge "Reminiscent"

# Sherlocks
htb sherlock list
htb sherlock info "Meerkat"
htb sherlock tasks "Meerkat"         # List questions
htb sherlock download "Meerkat"
htb sherlock own "Meerkat" "answer" --task 1

# VPN
htb vpn status
htb vpn status labs
htb vpn status competitive
htb vpn connections
htb vpn servers                      # Defaults to labs
htb vpn servers --product competitive
htb vpn servers --product starting_point
htb vpn switch 123
htb vpn download 123                 # TCP by default
htb vpn download 123 --udp           # UDP variant

# Seasons/Arena
htb season list
htb season machines
htb season active
htb season rank                      # Current season
htb season rank 9                    # Specific season
htb season leaderboard --limit 20
htb season leaderboard 9 --limit 10
htb season own 'flag'

JSON Output

All commands support --raw / -r flag for JSON output:

# Get machine IP
htb machine active -r | jq '.info.ip'

# List machine names
htb machine list -r | jq '.data[].name'

# Script example
IP=$(htb machine active -r | jq -r '.info.ip')
nmap -sV $IP

API Reference

Full API docs: https://gubarz.github.io/unofficial-htb-api/

License

MIT

Project details


Download files

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

Source Distribution

htb_terminal-1.0.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

htb_terminal-1.0.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file htb_terminal-1.0.0.tar.gz.

File metadata

  • Download URL: htb_terminal-1.0.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for htb_terminal-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c1c4ed224f56bc7572f1fcd2db5101d034b3a7b16705ca934f5d9dee7b0bcf7c
MD5 a3b7862671d2275a41c18f7f704bf204
BLAKE2b-256 01d6394987d9941f5198a5c935f79e704c4abeabda1da12937275e9490db2f01

See more details on using hashes here.

File details

Details for the file htb_terminal-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: htb_terminal-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for htb_terminal-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d3679b4b8bdb43b37adadd28e74d072f6876b70bfdac88ba7b125bf98a4cece
MD5 750d54ad849f21aadf0d9e5a40a34287
BLAKE2b-256 2684f5dfff9165f2582f5a55bc019d7887fa2d394fb873106cd7af2786845f83

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