PyHTBcli
PyHTBcli is a Python command line interface for interacting with HackTheBox.
Installation
Requirements
Make sure nmcli is installed. Present on most Linux distros. Install with apt install network-manager.
To make fonts print nicely, need a Nerd Font. Install:
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Ubuntu.zip -O /tmp/Ubuntu.zip
mkdir -p ~/.local/share/fonts
unzip /tmp/Ubuntu.zip -d ~/.local/share/fonts
fc-cache -fv
Install PyHTBcli
pip install pyHTBcli
Shell Auto-Complete
Bash: Add this line to ~/.bashrc:
eval "$(_htb_COMPLETE=bash_source htb)"
Zsh: Add this line to ~/.zshrc:
eval "$(_HTB_COMPLETE=zsh_source htb)"
Fish: Add this to ~/.config/fish/completions/htb.fish:
eval (env _HTB_COMPLETE=fish_source htb)
Running
HTBShell
From the command line, run htb:
$ htb
.-⁻⁻-._
.-⁻` `⁻-.
.-⁻` `⁻-_ __ __ ______ ____ ___
|`⁻-. .-|/\ \/\ \/\__ _\/\ _`\ /\_ \ __
| `⁻-. .-⁻` |\ \ \_\ \/_/\ \/\ \ \L\ \ ___\//\ \ /\_\
| `⁻-...-⁻` | \ \ _ \ \ \ \ \ \ _ <' /'___\\ \ \\/\ \
| | | \ \ \ \ \ \ \ \ \ \ \L\ \/\ \__/ \_\ \\ \ \
| | | \ \_\ \_\ \ \_\ \ \____/\ \____\/\____\ \_\
| | | \/_/\/_/ \/_/ \/___/ \/____/\/____/\/_/
`⁻-. | .-`
`⁻-. | .-⁻`
`⁻-..|-⁻`
HackTheBox> help
Documented commands (type help <topic>):
========================================
box status version vpn
Undocumented commands:
======================
exit help quit
Single Commands
Single commands can be giving from the command line as well:
$ htb -h
Usage: htb [OPTIONS] COMMAND [ARGS]...
HackTheBox Shell
Options:
--cache-cred [None|Short|Long] Cache access token and refresh token. Short
tokens are valid for 1 day, Long for 30
days.
--cache-location PATH Location of file that stores the cached
credential.
-h, --help Show this message and exit.
Commands:
box Information and interaction with Boxes
status Print comprehensive status
version Get the library version.
vpn VPN Connection Commands