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
.
- β 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
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
Make sure your .ovpn
file is placed correctly:
~/Desktop/Hackerstuff/Hackthebox/academy-regular.ovpn
chmod +x ~/Desktop/Hackerstuff/Hackthebox/htb_auto.sh
Edit your ~/.bashrc
(or ~/.zshrc
) and add:
alias htbstart='~/Desktop/Hackerstuff/Hackthebox/htb_auto.sh'
Apply changes:
source ~/.bashrc
htbstart
-
Connects to the HTB VPN using your
.ovpn
file -
Waits for the VPN to establish
-
Prompts you to enter the target IP
-
Logs your session
-
SSHs into the machine using:
- Username:
htb-student
- Password:
HTB_@cademy_stdnt!
- Username:
-
After SSH ends, gives you an option to disconnect the VPN
openvpn
sshpass
bash
shell
Install dependencies (if missing):
sudo apt update
sudo apt install openvpn sshpass -y
Made with π₯ by Aditya a.k.a thedvlprguy