Skip to content

thedvlprguy/myuselessscriptforhtbssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 

Repository files navigation

HTBStart – Hack The Box VPN + SSH Automation Script

A powerful Bash script to automate your Hack The Box (HTB) workflow β€” connects to the HTB Academy VPN and directly SSHs into the target machine in seconds with a single command: htbstart.


βš™οΈ Features

  • βœ… One-liner to start HTB lab workflow
  • πŸ”’ Auto-connects to HTB VPN (OpenVPN)
  • 🧠 Prompts for target IP dynamically
  • 🧠 Auto SSH into target machine (with pre-set credentials)
  • πŸ“ Logs your IP connection history
  • πŸ›‘ Option to auto-disconnect VPN after SSH session

πŸ“ Folder Structure (Between this is my folder structure

Hackerstuff/
└── Hackthebox/
    β”œβ”€β”€ academy-regular.ovpn     # Your HTB VPN file
    β”œβ”€β”€ htb_auto.sh              # Automation script
    └── htb_log.txt              # Connection history log (auto-created)

Suggestion: Instead of making that htbstart command in separate directory, make that in your home directory , so you'can access it anytime anywhere


πŸ› οΈ Setup

1. Clone or Download

Make sure your .ovpn file is placed correctly:

~/Desktop/Hackerstuff/Hackthebox/academy-regular.ovpn

2. Make Script Executable

chmod +x ~/Desktop/Hackerstuff/Hackthebox/htb_auto.sh

3. Add htbstart Alias

Edit your ~/.bashrc (or ~/.zshrc) and add:

alias htbstart='~/Desktop/Hackerstuff/Hackthebox/htb_auto.sh'

Apply changes:

source ~/.bashrc

πŸš€ Usage

htbstart
  1. Connects to the HTB VPN using your .ovpn file

  2. Waits for the VPN to establish

  3. Prompts you to enter the target IP

  4. Logs your session

  5. SSHs into the machine using:

    • Username: htb-student
    • Password: HTB_@cademy_stdnt!
  6. After SSH ends, gives you an option to disconnect the VPN


🧩 Requirements

  • openvpn
  • sshpass
  • bash shell

Install dependencies (if missing):

sudo apt update
sudo apt install openvpn sshpass -y

✨ Author

Made with πŸ”₯ by Aditya a.k.a thedvlprguy


About

Time Saving Script for connecting htb-labs in 2-5 seconds

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages