|
1 | 1 | # htb-cli |
2 | | - |
3 | 2 |
|
4 | 3 |  |
5 | 4 |  |
|
17 | 16 | <img alt="arm64" src="https://img.shields.io/badge/arm64%20(aarch64)-supported-success"> |
18 | 17 | </div> |
19 | 18 |
|
| 19 | +<div align="center"> |
| 20 | + <img src="./assets/logo.png" alt="Alt text" width="400"> |
| 21 | +</div></br> |
| 22 | + |
20 | 23 | ## Installation |
21 | 24 |
|
22 | 25 | `go install github.com/GoToolSharing/htb-cli@latest` |
23 | 26 |
|
24 | 27 | ## Configuration |
25 | 28 |
|
26 | | -You must add a Hackthebox **App token** in the **HTB_TOKEN** environment variable (zshrc maybe). |
27 | | -API Token can be find here : https://app.hackthebox.com/profile/settings => `Create App Token` |
| 29 | +In order to use `htb-cli`, you need to generate a **HackTheBox application token**. This token can be generated via your account configuration page: https://app.hackthebox.com/profile/settings, then by clicking on `Create App Token`. |
| 30 | + |
| 31 | +This API token must be set in the **HTB_TOKEN** environment variable. You can add it directly to your `bashrc / zshrc` to make it permanent. |
28 | 32 |
|
29 | 33 | ``` |
30 | 34 | export HTB_TOKEN=eyJ... |
31 | 35 | ``` |
32 | 36 |
|
33 | | -## Helper |
| 37 | +## Commands |
| 38 | + |
| 39 | +To exit a tview, press `CTRL + C`. |
| 40 | + |
| 41 | +### Helper |
| 42 | + |
| 43 | +```bash |
| 44 | +❯ htb-cli help |
| 45 | + |
| 46 | +This software, engineered using the Go programming language, serves to streamline and automate various tasks for the HackTheBox platform, enhancing user efficiency and productivity. |
| 47 | + |
| 48 | +Usage: |
| 49 | + htb-cli [command] |
| 50 | + |
| 51 | +Available Commands: |
| 52 | + help Help about any command |
| 53 | + info Detailed information on challenges and machines |
| 54 | + machines Displays active / retired machines and next machines to be released |
| 55 | + reset Reset a machine |
| 56 | + start Start a machine |
| 57 | + status Displays the status of hackthebox servers |
| 58 | + stop Stop the current machine |
| 59 | + submit Submit credentials (machines / challenges / arena) |
| 60 | + |
| 61 | +Flags: |
| 62 | + -b, --batch Don't ask questions |
| 63 | + -h, --help help for htb-cli |
| 64 | + -p, --proxy string Configure a URL for an HTTP proxy |
| 65 | + -v, --verbose Verbose mode |
| 66 | +
|
| 67 | +Use "htb-cli [command] --help" for more information about a command. |
| 68 | +``` |
| 69 | +
|
| 70 | +### info |
| 71 | +
|
| 72 | +The `info` command will retrieve information from the active machine (if any) and display it. If no argument is supplied, the logged-in user's information will be displayed. |
| 73 | +You can combine machines / challenges and users. |
| 74 | + |
| 75 | +```bash |
| 76 | +Flags: |
| 77 | + -c, --challenge strings Challenge name |
| 78 | + -h, --help help for info |
| 79 | + -m, --machine strings Machine name |
| 80 | + -u, --username strings Username |
| 81 | +
|
| 82 | +Global Flags: |
| 83 | + -b, --batch Allows all questions |
| 84 | + -p, --proxy string Configure a URL for an HTTP proxy |
| 85 | + -v, --verbose Verbose mode |
| 86 | +``` |
| 87 | + |
| 88 | +```bash |
| 89 | +❯ htb-cli info |
| 90 | +
|
| 91 | +? Do you want to check for active machine ? No |
| 92 | +
|
| 93 | +? The following username was found : QU35T3190 Yes |
| 94 | +``` |
| 95 | + |
| 96 | +```bash |
| 97 | +❯ htb-cli info -c test -m Sau -u Yakei |
| 98 | +
|
| 99 | +? Do you want to check for active machine? No |
| 100 | +? The following machine was found : Sau Yes |
| 101 | +Name |OS |Retired |Difficulty |Stars |IP |Status |Last Reset |Release |
| 102 | +Sau |Linux |No |Easy |4.6 |Undefined |User & Root |1 month before |2023-07-08 |
| 103 | +? The following challenge was found : Leet Test Yes |
| 104 | +Name |Category |Retired |Difficulty |Stars |Solves |Status |Release |
| 105 | +Leet Test |Pwn |Yes |Easy |4.9 |256 |No flags |2020-11-18 |
| 106 | +? The following username was found : Yakei Yes |
| 107 | +``` |
| 108 | + |
| 109 | +### machines |
| 110 | + |
| 111 | +The `machines` command displays the list of active machines, the last 20 machines removed and the next machines planned. |
| 112 | +The command requires no arguments. |
| 113 | + |
| 114 | +```bash |
| 115 | +❯ htb-cli machines |
| 116 | +``` |
| 117 | + |
| 118 | +### start |
| 119 | + |
| 120 | +The `start` command starts an instance for a machine. The machine name must be specified using the `-m` or `--machine` argument. Once started, its IP address is displayed. |
| 121 | + |
| 122 | +```bash |
| 123 | +Flags: |
| 124 | + -h, --help help for start |
| 125 | + -m, --machine string Machine name |
| 126 | +
|
| 127 | +Global Flags: |
| 128 | + -b, --batch Allows all questions |
| 129 | + -p, --proxy string Configure a URL for an HTTP proxy |
| 130 | + -v, --verbose Verbose mode |
| 131 | +``` |
| 132 | + |
| 133 | +```bash |
| 134 | +❯ htb-cli start -m Visual |
| 135 | +
|
| 136 | +? The following machine was found : Visual Yes |
| 137 | +Machine deployed to lab. Playing on a VIP server |
| 138 | +Target: 10.10.11.234 |
| 139 | +``` |
| 140 | + |
| 141 | +### stop |
| 142 | + |
| 143 | +The `stop` command is used to stop a machine instance. No arguments are required. The current machine will be stopped. |
34 | 144 |
|
35 | | - |
| 145 | +```bash |
| 146 | +❯ htb-cli stop |
36 | 147 |
|
37 | | -## Start |
| 148 | +Machine terminated. VIP server available |
| 149 | +``` |
38 | 150 |
|
39 | | - |
| 151 | +### reset |
40 | 152 |
|
41 | | -## Stop |
| 153 | +The `reset` command is used to request the reset of an instance. No arguments are required. The reset request will be made for the current machine. |
42 | 154 |
|
43 | | - |
| 155 | +```bash |
| 156 | +❯ htb-cli reset |
44 | 157 |
|
45 | | -## Reset |
| 158 | +No active machine found |
| 159 | +``` |
46 | 160 |
|
47 | | - |
| 161 | +### status |
48 | 162 |
|
49 | | -## Submit |
| 163 | +The `status` command displays the status of hackthebox servers. |
50 | 164 |
|
51 | | -### Submit machine flag |
| 165 | +```bash |
| 166 | +❯ htb-cli status |
52 | 167 |
|
53 | | - |
| 168 | +All Systems Operational |
| 169 | +``` |
54 | 170 |
|
55 | | -### Submit challenge flag |
| 171 | +### submit |
56 | 172 |
|
57 | | - |
| 173 | +The `submit` command is used to submit a flag. Currently, the following submissions are supported : |
58 | 174 |
|
59 | | -## Info |
| 175 | +* VIP machines |
| 176 | +* VIP+ machines |
| 177 | +* Machines Free |
| 178 | +* Release Arena |
| 179 | +* Challenges |
60 | 180 |
|
61 | | - |
| 181 | +If there is no `--machine` or `--challenge` flag, submission will be made on the current active machine. Otherwise, this can be specified with the `--machine` and `--challenge` flags. |
62 | 182 |
|
63 | | - |
| 183 | +```bash |
| 184 | +❯ htb-cli submit -f flag4testing -d 3 |
| 185 | +
|
| 186 | +No machine is running |
| 187 | +``` |
| 188 | + |
| 189 | +```bash |
| 190 | +❯ htb-cli submit -c test -f flag4testing -d 3 |
| 191 | +
|
| 192 | +? The following challenge was found : Leet Test Yes |
| 193 | +Incorrect flag |
| 194 | +``` |
64 | 195 |
|
65 | | -## Status |
| 196 | +```bash |
| 197 | +❯ htb-cli submit -m Sau -f flag4testing -d 3 |
66 | 198 |
|
67 | | - |
| 199 | +? The following machine was found : Sau Yes |
| 200 | +Incorrect flag! |
| 201 | +``` |
0 commit comments