Skip to main content

A library to interact with the hackthebox.eu website

Project description

HTBClient

HTBClient is a python module that interfaces with the hackthebox.eu REST API. Since their API doesn't appear to be complete there are features that are currently missing such as challenges. These will be added once they have REST endpoints but I have decided not to implement them now by scraping the site as I felt that would be too fragile and would add a significant amount of throw away code.

Overview Video

insert youtube link here

Installation

There are several options for installation, i'll cover the common ones below.

Installation of the latest version in PyPi via pip

python3 -m pip install htbclient

Installation of the latest version in the github repository

python3 -m pip install git+https://github.com/BGrewell/HTBClient

Usage

HTBClient can be used as a stand-alone script or imported into your own project. An example of this is my htb-repo project which is a skeleton that I use to organize all the various challenges and boxes from hackthebox.eu. This repo works by having a basic folder layout to organize challenges and machines, then it uses the HTBClient to connect to the websites REST API and creates a folder for each machine that is found on the site but not on the file system, it also creates some metadata files and scripts to help with tracking and controlling the machines. To find out more about the htb-repo project click on this link to visit the repository.

Setting Username/Password

If you are using HTBClient as a module then you need to pass the username and password when you create your instance. When using HTBClient as a module it is recommended that you get your username and password from an environmental variable or some place other than hard-coding it in your source that way if you source is shared you do not accidentally publish your credentials as well.

when running the htb command from the terminal you should set your credentials as environmental variables then run the htb command as shown below

Example

export HTB_USER=bob@somewebsite.net
export HTB_PASS=2jli9z9e2l34jlz98890@skx9!2a&
htb <arguments>

Command Line Tool

The command line tool htb has the following options

--assigned          # Show your currently assigned machine
--list all          # Show all machines
--list todo         # Show machines in your todo list
--list spawned      # Show all machines that are currently running
--list active       # Show all machines that have not been retired
--list retired      # Show all machines that have been retired
--list owned        # Show all machines that you have gotten root and user on
--list roots        # Show all machines that you have gotten root on
--list users        # Show all machines that you have gotten user on
--list incomplete   # Show all machines that you have not yet owned
--start <machine>   # Start the specified machine
--stop              # Stop the machine assigned to you
--reset <machine>   # Restart the specified machine
--todo <machine>    # Toggle the specified machines todo status
--username <user>   # HTB Username (only needed if you don't use variables)
--password <pass>   # HTB Password (only needed if you don't use variables)

The command line tool is installed into the systems path as htb so you would execute the above commands as shown in the example below

list all machines

htb --list all

list owned machines

htb --list owned

start the box Ellingson

htb --start ellingson

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

HTBClient-0.2.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

HTBClient-0.2.0-py2.py3-none-any.whl (13.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file HTBClient-0.2.0.tar.gz.

File metadata

  • Download URL: HTBClient-0.2.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5

File hashes

Hashes for HTBClient-0.2.0.tar.gz
Algorithm Hash digest
SHA256 24a691d7ec59d3392e651b92d585d640f2a3718685924f8cfb728b895b45ea51
MD5 9a9dc776107fb6e20cf019ac8b0295d6
BLAKE2b-256 6dbd274fa6659b6510f23e4d33c5db15632f8ca5645517f721652a6df600f7d1

See more details on using hashes here.

File details

Details for the file HTBClient-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: HTBClient-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5

File hashes

Hashes for HTBClient-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 782d323fc722b2aea1003bab90e7b5611137bac1782485e8e9f33dc0fe8f6a6e
MD5 285e2ad556cd31a93e4d2bd008f1c018
BLAKE2b-256 e734faee0b8cdf31f6373b65021debd634734e18f934c3f33f32ffc634366c97

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