Hack The Box To Notion

Payas KalePayas Kale
4 min read

hackthebox-notion

Aim

The Python script automates the process of fetching machines from the Hack The Box platform and storing them in a Notion database. Users provide essential parameters such as the Notion Database ID, Notion Token, and Hack The Box Token through a .env file. The script utilizes these tokens to authenticate and access both platforms. Additionally, it incorporates a pre-defined template for each machine within Notion, ensuring consistent formatting and structure. This streamlined approach simplifies the task of cataloging machines, enhancing efficiency and organization for users managing their Hack The Box progress.

What are these platforms for?

Hack The Box

Hack The Box or otherwise also known as HTB is an online platform that provides hands-on training in cybersecurity through various challenges and virtual labs. It offers a gamified environment where users can enhance their skills in penetration testing, reverse engineering, web application security, cryptography, and other related fields. Participants, often referred to as "hackers," solve challenges by exploiting vulnerabilities in simulated systems, gaining points and rankings as they progress. Hack The Box also features an active community where users can collaborate, share knowledge, and discuss cybersecurity topics. It serves as a valuable resource for individuals seeking to develop practical cybersecurity skills and stay updated on the latest techniques and tools in the field.

Some similar apps to HTB

  1. TryHackMe
  2. VulnHub

Many more...

Notion

Notion is an all-in-one workspace and collaboration platform that enables users to create, organize, and share information in various formats. It combines the functionalities of note-taking, project management, document collaboration, and database management into a single intuitive interface. Users can create pages, databases, and templates to structure their work, and customize them with text, images, files, and embedded content. Notion offers flexibility in organizing information, allowing users to create hierarchical structures, link related items, and tag content for easy retrieval. It also supports real-time collaboration, enabling teams to work together on documents, tasks, and projects. Notion is highly customizable, with features such as kanban boards, calendars, and timelines, making it suitable for personal use, team collaboration, and knowledge management across various domains.

Some similar apps to Notion

  1. Cherry Tree
  2. GitBook - will check in the future
  3. Evernote - Not tried yet

Many more...

Now, let's move on to explore the practical requirements and installation process for the project

Requirements

Installation

  1. Clone this repository:
    git clone https://github.com/spllat-00/hackthebox-notion.git
    
  2. Install the required Python packages
    pip install -r requirements.txt
    
  3. Setup your Notion integration and get your API credentials.

    • Visit Notion integration

      NotionIntegration-Step1

    • Add to your required workspace

    • Give the integration a name: HackTheBox-Notion (Can be anything as per user)

    • Add logo for easy access. (Logo provided in git repo)
    • Hit Submit

      NotionIntegration-Step2

    • View your Secret, by click show

      NotionIntegration-Step3

    • This is: NOTIONTOKEN in .env file

  4. Setup your Hack The Box App Token

    • Visit Hack The Box Settings
    • Click Generate Identifier

      HackTheBox-Step1

    • Give it a name: HackTheBox2Notion (Can be anything as per user)

    • Set the expire time: 1 Year

      HackTheBox-Step2

    • Copy the App Token

      HackTheBox-Step3

    • This is: HTBTOKEN in .env file

  5. Copy the template Hack The Box - Notion Template

  1. Connect the newly created notion integration to the workspace

    • Select options in top-right.
    • In Connections > Connect to, select: HackTheBox-Notion

      NotionConnections-Step1

    • Hit Confirm

      NotionConnections-Step2

  1. Find the Database ID

    • On the database of gallery, hit 6-dots

      NotionDatabaseID-Step1

    • Select Copy link

      NotionDatabaseID-Step2

    • It will be in this format: https://www.notion.so/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?v=someOtherFormathere&pvs=4

    • We need the xxxxx part, that should be of 32 characters
    • This is: NOTIONDATABASEID
  2. Create a file with name .env file with NOTIONTOKEN, HTBTOKEN and NOTIONDATABASEID values from above

Usage

Run the script

python3 HTB2Notion.py

For checking the help, use flag: -h / --help

Screenshots

  1. Running of the script for new machines

RunningScript

  1. Template

NotionMachineTemplate-Step1

NotionMachineTemplate-Step2

NotionMachineTemplate-Step3

Configuration

  • HTBTOKEN=HTB_JWT_Token
  • NOTIONTOKEN=Notion_Token
  • NOTIONDATABASEID=32-bit-ID

Contributing

Contributions are welcome! Feel free to open issues or pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

0
Subscribe to my newsletter

Read articles from Payas Kale directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Payas Kale
Payas Kale

Hey there! I'm Payas ๐Ÿ‘‹, a tech enthusiast who loves digging into computer security and creating cool stuff with code. When I'm not busy working on IT stuff, I'm having a blast playing Valorant ๐ŸŽฎ.