Giter VIP home page Giter VIP logo

htb-academy-to-md's Introduction

HackTheBox Academy to Markdown

This is a simple CLI application that will fetch and convert a HackTheBox Academy module into a local file in Markdown format. This program will only grab one module at a time, and requires authenticating with the platform. You will also need to have the module unlocked, which should go without saying.

I personally use Obsidian as my note-taking tool, and this application is tailored and tested for rendering markdown utilizing it. Most other note-taking tools that can import markdown files should work fine as well.

Disclaimer

Please note that this application is not intended for use in uploading or sharing the end result content. The application is solely designed for personal use and any content created using this application should not be shared or uploaded to any platform without proper authorization and consent from HackTheBox. The contributors of this application are not responsible for any unauthorized use or distribution of the content created using this application.

Installing

Check the releases folder here, and download the most recent executable for your operating system. All the executables listed here are for x64 and amd64. If there is not an executable for your OS or architecture, you can simply build the application. (See building section below.)

Running

These steps have changed slightly with the reCaptcha update on the HackTheBox platform. I see this current state as a workaround for not dealing with the reCaptcha until I have more time to dig into that.

Essentially instead of passing your email and password, you will just pass your authenticated session cookies to the application to use. So the one added step for the workaround is manually logging into the academy (I would assume you are logged into Academy anyway to get the module URL), and extracting your cookies from your browser. You can fetch these with the developer tools, burp, or a browser extension, whatever works easiest for you. The cookies will get passed to the new -c argument, and you no longer need to pass an email or password.

# Get the help menu displayed
htb-academy-to-md -h

# Feed the URL to the module.
htb-academy-to-md -m https://academy.hackthebox.com/module/112/section/1060 -c "htb_academy_session=value; XSRF-TOKEN=value; some-other-cookie=value"

# Save images in module locally.
htb-academy-to-md -m https://academy.hackthebox.com/module/112/section/1060 -local_images -c "htb_academy_session=value; XSRF-TOKEN=value; some-other-cookie=value"

# You can also grab multiple modules using a simple loop if preferred. (bash example)
for i in $(cat modules.txt);do htb-academy-to-md -m $i -c "htb_academy_session=value; XSRF-TOKEN=value; some-other-cookie=value";done

Building

# Run from inside the /src folder.
go build -o htb-academy-to-md

htb-academy-to-md's People

Contributors

tut-k0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

htb-academy-to-md's Issues

/ in module name causes issue

When there is a / (forward slash) in the module name it causes an issue as they are not allowed in a filename. For example, this module https://academy.hackthebox.com/module/226/section/2419 gives the error open Working with IDS/IPS.md: The system cannot find the path specified.
Substituting / for a - (hyphen) would probably work best. I dont know go language so dont know how easy this is to implement.

I am trying this on Windows, I havent tried using this on Linux.

Authenticating to HackTheBox failed - error 422

while running the script I get this error (I don't have 2fa or strange passwords, everything worked before, I think htb has changed something):

Authenticating with HackTheBox...
Authenticating to HackTheBox failed.
Unexpected status code: 422
Response body: {"message":"The g-recaptcha-response field is required.","errors":{"g-recaptcha-response":["The g-recaptcha-response field is required."]}}

New HTB Account

Hi,
Now that HTB is using the new "HTB Account" which uses the details from the Labs platform, do you have plans to use this login system? Currently neither my Academy or Labs password works and I get the following error:

panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]:
main.getModulePages({0xc0001dc000, 0x295d}, {0xc000014200, 0x34})
        /home/tut/Programming/go/htb-academy-md/src/export.go:217 +0x177
main.getModule({0xc000014200, 0x34}, {{0xc000230780?, 0x17?}, {0xc000108000?, 0x3dd7c8?}})
        /home/tut/Programming/go/htb-academy-md/src/export.go:142 +0x3b4
main.main()
        /home/tut/Programming/go/htb-academy-md/src/main.go:13 +0xd7

My HTB Account doesnt have 2FA enabled.

Thanks

panic: runtime error: slice bounds out of range [1:0]

The error I get when running the exe using the correct format
panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]:
main.getModulePages({0xc000248a00, 0x144b}, {0xc0000103c0, 0x36})
/home/tut/Programming/go/htb-academy-md/src/export.go:204 +0x177
main.getModule({0xc0000103c0, 0x36}, {{0xc000264090?, 0x8?}, {0xc000170000?, 0x3bd668?}})
/home/tut/Programming/go/htb-academy-md/src/export.go:133 +0x3b4
main.main()
/home/tut/Programming/go/htb-academy-md/src/main.go:13 +0xd7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.