Skip to content

Instantly share code, notes, and snippets.

@Spy0x7
Forked from kavishkagihan/htb-setup.sh
Created October 4, 2022 19:58
Show Gist options
  • Save Spy0x7/d418c661e4f13829d7a31301356527fa to your computer and use it in GitHub Desktop.
Save Spy0x7/d418c661e4f13829d7a31301356527fa to your computer and use it in GitHub Desktop.
Automated tmux session I use when playing htb boxes
#!/bin/bash
HTB_DATA_DIR=~/Documents/HTB/
if [[ $1 ]]; then
a=1
else
echo "Usage: $0 <Box name>"
exit 1
fi
tmux new-session -s htb -d -n win1
tmux new-window -t htb -d -n win2
tmux new-window -t htb -d -n win3
tmux new-window -t htb -d -n vpn
tmux send-keys -t htb:vpn "echo $SUDO_PASS| sudo -S /usr/sbin/openvpn /home/kavi/Documents/HTB/lab_kavigihan.ovpn" Enter
tmux select-window -t htb:win1
tmux send-keys -t htb:win1 "if [[ -d $HTB_DATA_DIR$1 ]]; then else htb-init $1; fi; cd $HTB_DATA_DIR$1; clear" Enter
tmux split-window -h
tmux send-keys "cd $HTB_DATA_DIR$1; clear" Enter
tmux split-window -v
tmux send-keys "cd $HTB_DATA_DIR$1; clear" Enter
tmux select-layout main-vertical
tmux select-window -t htb:win2
tmux send-keys "cd $HTB_DATA_DIR$1; clear" Enter
tmux split-window -v
tmux send-keys "cd $HTB_DATA_DIR$1; clear" Enter
tmux send-keys -t htb:win3 "cd $HTB_DATA_DIR$1; clear" Enter
tmux select-window -t htb:win1
tmux attach -t htb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment