Skip to content

Commit 2acce62

Browse files
committed
Merge branch 'release/v1.3.1' into main
2 parents 3d25e3c + 1717b9a commit 2acce62

30 files changed

Lines changed: 911 additions & 456 deletions
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG] <title>"
5+
labels: bug
6+
assignees: QU35T-code
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.

.github/workflows/go.yml

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -31,62 +31,4 @@ jobs:
3131
env:
3232
GOOS: ${{ matrix.os }}
3333
GOARCH: ${{ matrix.arch }}
34-
run: go build -v ./...
35-
36-
tests:
37-
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && !github.event.pull_request.draft)
38-
needs: build
39-
runs-on: ubuntu-latest
40-
name: Update coverage badge
41-
steps:
42-
- name: Checkout
43-
uses: actions/checkout@v2
44-
with:
45-
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
46-
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
47-
48-
- name: Setup go
49-
uses: actions/setup-go@v2
50-
with:
51-
go-version: '1.19'
52-
53-
- uses: actions/cache@v2
54-
with:
55-
path: ~/go/pkg/mod
56-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
57-
restore-keys: |
58-
${{ runner.os }}-go-
59-
60-
- name: Run Test
61-
run: |
62-
go test -v ./... -covermode=set -coverprofile=coverage.out
63-
go tool cover -func=coverage.out -o=coverage.out
64-
env:
65-
HTB_TOKEN: ${{ secrets.HTB_TOKEN }}
66-
TEST: "true"
67-
68-
- name: Go Coverage Badge
69-
uses: tj-actions/coverage-badge-go@v2
70-
with:
71-
filename: coverage.out
72-
73-
- name: Verify Changed files
74-
uses: tj-actions/verify-changed-files@v12
75-
id: verify-changed-files
76-
with:
77-
files: README.md
78-
79-
- name: Commit changes
80-
if: steps.verify-changed-files.outputs.files_changed == 'true'
81-
run: |
82-
git config --local user.email "action@github.com"
83-
git config --local user.name "GitHub Action"
84-
git add README.md
85-
git commit -m "chore: Updated coverage badge."
86-
87-
- name: Push changes
88-
if: steps.verify-changed-files.outputs.files_changed == 'true'
89-
uses: ad-m/github-push-action@master
90-
with:
91-
github_token: ${{ secrets.TOKEN_PUSH }}
92-
branch: dev
34+
run: go build -v ./...

README.md

Lines changed: 155 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# htb-cli
2-
![Coverage](https://img.shields.io/badge/Coverage-17.4%25-red)
32

43
![Workflows (main)](https://github.com/GoToolSharing/htb-cli/actions/workflows/go.yml/badge.svg?branch=main)
54
![Workflows (dev)](https://github.com/GoToolSharing/htb-cli/actions/workflows/go.yml/badge.svg?branch=dev)
@@ -17,51 +16,186 @@
1716
<img alt="arm64" src="https://img.shields.io/badge/arm64%20(aarch64)-supported-success">
1817
</div>
1918

19+
<div align="center">
20+
<img src="./assets/logo.png" alt="Alt text" width="400">
21+
</div></br>
22+
2023
## Installation
2124

2225
`go install github.com/GoToolSharing/htb-cli@latest`
2326

2427
## Configuration
2528

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.
2832

2933
```
3034
export HTB_TOKEN=eyJ...
3135
```
3236

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.
34144

35-
![Helper](/assets/helper.png)
145+
```bash
146+
❯ htb-cli stop
36147
37-
## Start
148+
Machine terminated. VIP server available
149+
```
38150

39-
![Start machine](/assets/start.png)
151+
### reset
40152

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.
42154

43-
![Stop machine](/assets/stop.png)
155+
```bash
156+
❯ htb-cli reset
44157
45-
## Reset
158+
No active machine found
159+
```
46160

47-
![Reset machine](/assets/reset.png)
161+
### status
48162

49-
## Submit
163+
The `status` command displays the status of hackthebox servers.
50164

51-
### Submit machine flag
165+
```bash
166+
❯ htb-cli status
52167
53-
![Submit machine flag](/assets/submit_machine.png)
168+
All Systems Operational
169+
```
54170

55-
### Submit challenge flag
171+
### submit
56172

57-
![Submit challenge flag](/assets/submit_challenge.png)
173+
The `submit` command is used to submit a flag. Currently, the following submissions are supported :
58174

59-
## Info
175+
* VIP machines
176+
* VIP+ machines
177+
* Machines Free
178+
* Release Arena
179+
* Challenges
60180

61-
![Info active machine](/assets/info_active.png)
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.
62182

63-
![Info machines](/assets/info_machines.png)
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+
```
64195

65-
## Status
196+
```bash
197+
❯ htb-cli submit -m Sau -f flag4testing -d 3
66198
67-
![Status](/assets/status.png)
199+
? The following machine was found : Sau Yes
200+
Incorrect flag!
201+
```

assets/helper.png

-299 KB
Binary file not shown.

assets/info_active.png

-123 KB
Binary file not shown.

assets/info_machines.png

-202 KB
Binary file not shown.

assets/logo.png

675 KB
Loading

assets/reset.png

-66.9 KB
Binary file not shown.

assets/start.png

-86.6 KB
Binary file not shown.

assets/status.png

-63.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)