Skip to content

Commit

Permalink
Add home, installation and configuration documentation pages
Browse files Browse the repository at this point in the history
  • Loading branch information
QU35T-code committed Jan 8, 2024
1 parent cd77ea9 commit 6d546cb
Show file tree
Hide file tree
Showing 18 changed files with 201 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ci
on:
push:
branches:
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv/
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
htb-cli-documentation.qu35t.pw
Binary file added docs/assets/configuration/discord.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/configuration/new-webhook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/configuration/profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/configuration/token-create.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/configuration/token-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/configuration/token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/configuration/webhook-copy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/configuration/webhook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Configuration

## API token

In order to use `htb-cli`, you need to generate a **HackTheBox application token**. This token can be generated via your account configuration page: <a href="https://app.hackthebox.com/profile/settings" target="_blank">https://app.hackthebox.com/profile/settings</a>, then by clicking on **Create App Token**.

![Settings page](/assets/configuration/token.png)

You need to enter a **name** for the API token and an **expiry date**. In the following example, the name is **htbcli** and the expiry date is set to the maximum, i.e. **1 year**.

![New token](/assets/configuration/token-create.png)

The value of the token will be displayed only when it is created. Don't forget to **copy it**, otherwise you'll have to regenerate it.

![Token value](/assets/configuration/token-value.png)

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.

```bash
echo "export HTB_TOKEN=eyJ..."|tee -a ~/.zshrc
```

The shell must be refreshed for the changes to take effect. You can use the `source` command to reload the contents of the **bashrc / zshrc** file. Otherwise, when a new terminal is opened, the shell will be updated.

```bash
source ~/.zshrc
```

## Configuration file

A default configuration file is created the first time the tool is running at the following path : $HOME/.local/htb-cli/default.conf.
This is a Key / Value configuration file.

### Discord webhooks
The `Discord key` links `htb-cli` with discord webhooks.
First of all, to create a **webhook discord**, click on the **settings** button from a text channel.

![Webhook](/assets/configuration/webhook.png)

Next, click on the **Integrations** tab, then **Create a webhook**.

![New Webhook](/assets/configuration/new-webhook.png)

Copy the URL of the webhook and you can also change the bot's name.

![Webhook Copy](/assets/configuration/webhook-copy.png)

The link to the webhook must be added to the `htb-cli` configuration file (**~/.local/htb-cli/default.conf**) as shown in the example below.

```bash
Discord = https://discord.com/api/webhooks/*************/****************************
```

Now, for each `htb-cli` command, a message will be sent via the discord webhook.

![Discord](/assets/configuration/discord.png)

## Sanity check

The following command can be used to check that the installation has been carried out correctly.

```bash
htb-cli info --batch
```

![Profile](/assets/configuration/profile.png)
12 changes: 12 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# htb-cli

<div style='text-align:center;'>
<img src="/assets/logo.png" style='width:50%;height:50%'>
</div>

htb-cli is a project developed and maintained by <a href="https://github.com/QU35T-code/" target="_blank">QU35T-code</a>. It interacts with the **API of <a href="https://app.hackthebox.com/" target="_blank">HackTheBox</a>**, a popular cybersecurity platform.
It responds to the need to be **competitive**, limit user interaction with the website and **save time** with possible actions.

## Demonstration

![Settings page](/assets/demo.gif)
36 changes: 36 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Installation

## Stable version

The **stable version (main branch)** of `htb-cli` only requires `golang version 20` to be installed (<a href="https://go.dev/doc/install" target="_blank">https://go.dev/doc/install</a>).

The following command downloads the binary :

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

```bash
htb-cli version
Stable version (main branch): v1.5.1
```

Make sure you have golang in your **PATH** so you don't run into any problems when executing the binary. The following code must be added to your **rc file (bashrc / zshrc)** to make it permanent.

```bash
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
```

## Development version

The **development version (dev branch)** can be installed using the following command:

```bash
go install github.com/GoToolSharing/htb-cli@dev
```

```bash
htb-cli version
Development version (dev branch): a4cab218bb5f9851028091eb74469d4e21c469d0
```
3 changes: 3 additions & 0 deletions docs/start/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# start the command

hello
54 changes: 54 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
site_name: htb-cli documentation
theme:
name: material
favicon: assets/logo.png
features:
- navigation.instant
- navigation.instant.prefetch
palette:

# Palette toggle for automatic mode
- media: "(prefers-color-scheme)"
toggle:
icon: material/brightness-auto
name: Switch to light mode

# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default


toggle:
icon: material/brightness-7
name: Switch to dark mode

# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
toggle:
icon: material/brightness-4
name: Switch to system preference

markdown_extensions:
- pymdownx.superfences:
custom_fences:
- name: codehilite
class: codehilite
format: !!python/name:pymdownx.superfences.fence_code_format
- codehilite:
guess_lang: false
css_class: highlight
- pymdownx.highlight:
use_pygments: true
- pymdownx.inlinehilite


nav:
- Home: index.md
- Installation: installation.md
- Configuration: configuration.md
# - Documentation:
# - Première Section: section1.md
# - Deuxième Section: section2.md
# - A Propos: about.md

0 comments on commit 6d546cb

Please sign in to comment.