diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..cda3d8c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eba74f4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +venv/ \ No newline at end of file diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..985f0bf --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +htb-cli-documentation.qu35t.pw \ No newline at end of file diff --git a/docs/assets/configuration/discord.png b/docs/assets/configuration/discord.png new file mode 100644 index 0000000..fc20272 Binary files /dev/null and b/docs/assets/configuration/discord.png differ diff --git a/docs/assets/configuration/new-webhook.png b/docs/assets/configuration/new-webhook.png new file mode 100644 index 0000000..c28cbc8 Binary files /dev/null and b/docs/assets/configuration/new-webhook.png differ diff --git a/docs/assets/configuration/profile.png b/docs/assets/configuration/profile.png new file mode 100644 index 0000000..704f438 Binary files /dev/null and b/docs/assets/configuration/profile.png differ diff --git a/docs/assets/configuration/token-create.png b/docs/assets/configuration/token-create.png new file mode 100644 index 0000000..a373f11 Binary files /dev/null and b/docs/assets/configuration/token-create.png differ diff --git a/docs/assets/configuration/token-value.png b/docs/assets/configuration/token-value.png new file mode 100644 index 0000000..c5f9eb3 Binary files /dev/null and b/docs/assets/configuration/token-value.png differ diff --git a/docs/assets/configuration/token.png b/docs/assets/configuration/token.png new file mode 100644 index 0000000..c9a300a Binary files /dev/null and b/docs/assets/configuration/token.png differ diff --git a/docs/assets/configuration/webhook-copy.png b/docs/assets/configuration/webhook-copy.png new file mode 100644 index 0000000..3f13a7e Binary files /dev/null and b/docs/assets/configuration/webhook-copy.png differ diff --git a/docs/assets/configuration/webhook.png b/docs/assets/configuration/webhook.png new file mode 100644 index 0000000..e01bcf8 Binary files /dev/null and b/docs/assets/configuration/webhook.png differ diff --git a/docs/assets/demo.gif b/docs/assets/demo.gif new file mode 100644 index 0000000..002f1cb Binary files /dev/null and b/docs/assets/demo.gif differ diff --git a/docs/assets/logo.png b/docs/assets/logo.png new file mode 100644 index 0000000..3c509b0 Binary files /dev/null and b/docs/assets/logo.png differ diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000..c9ece0b --- /dev/null +++ b/docs/configuration.md @@ -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: https://app.hackthebox.com/profile/settings, 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) diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..9c6d080 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,12 @@ +# htb-cli + +
+ +
+ +htb-cli is a project developed and maintained by QU35T-code. It interacts with the **API of HackTheBox**, 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) \ No newline at end of file diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 0000000..950dc29 --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,36 @@ +# Installation + +## Stable version + +The **stable version (main branch)** of `htb-cli` only requires `golang version 20` to be installed (https://go.dev/doc/install). + +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 +``` \ No newline at end of file diff --git a/docs/start/index.md b/docs/start/index.md new file mode 100644 index 0000000..1b5ce34 --- /dev/null +++ b/docs/start/index.md @@ -0,0 +1,3 @@ +# start the command + +hello \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..50e8bde --- /dev/null +++ b/mkdocs.yml @@ -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 + \ No newline at end of file