SSHuttle: Seamless VPN over SSH

Simplify your VPN setup with SSHuttle – the easy VPN over SSH.

SSHuttle: Because VPNs Shouldn't Be Rocket Science!

SSHuttle is a unique tool that acts as a VPN but uses SSH to encrypt and route traffic. It's ideal for those who need a secure connection without the hassle of traditional VPN setups. With SSHuttle, you can easily tunnel your internet traffic through an SSH server, ensuring your data is safe and your online activities remain private. Perfect for remote workers, digital nomads, and anyone looking for a simple, efficient way to stay secure online.

  • 1

    sudo apt install sshuttle

    We need python and IPtables
  • 2

    Scripts

    I created two scripts to easy connection.

                
    ❯ curl 192.168.80.246:8080
    curl: (56) Recv failure: Connection reset by peer 
            
    ❯ shutt xps
    
    _________________________________________________________
    
    Change port (22)? (y/N): 
    y
    Port SSH: 
    2246
    nat@192.168.88.13's password: 
    Subnets disponibles:
         1) 				wlp0s20f3: 192.168.88.13
         2) 				virbr0: 192.168.100.1
         3) 				br-0911adf24ce3: 172.18.0.1
         4) 				docker0: 172.17.0.1
         5) 				virbr1: 192.168.80.1
         6) 				proton0: 10.96.0.2
    Choose the  subnet for SSHuttle: 
    5
    
    _________________________________________________________
    
    Ejecutando SSHuttle con la subnet: 192.168.80.0/24
    sshuttle --dns -r xps:2246 --exclude 192.168.88.159 192.168.80.0/24 -D
            
    ❯ curl 192.168.80.246:8080
    sshutler
    flag:asdj9asda2
            
  • 3

    Sending ALL traffic

    Like a Wireguard vpn

                
    shutall xps
    
    _________________________________________________________
    
    Change port (22)? (y/N): 
    y
    SSH port?: 
    2246
    
    _________________________________________________________
    
    SSHuttle All traffic...
    
    sshuttle -D --dns -r xps:2246 --exclude 192.168.88.159 0/0
     
            
    Configured DNS servers:
    192.168.88.1
    
    s
    The Internet connection is active.
    
    Enter o espera 1.5s para cancelar: 
    _________________________________________________________
    
    66.110.23.11
    Buenos Aires
    Buenos Aires F.D.
    AR
    1871
    
            
    ❯ curl 192.168.80.246:8080
    sshutler ALL traffic
    
    flag:311sad1
            
  • That's all, enjoy.

    Code Example with Copy Functionality



    #!/bin/bash
    
    
    # Comprobamos que se ha pasado un argumento
    if [ "$#" -ne 1 ]; then
        echo -e "\033[0;31mUso: $0 user@ip\033[0m"
        exit 1
    fi
    
    REMOTE_HOST=$1
    
    # Pregunta al usuario si desea especificar un puerto SSH personalizado
    echo -e "\033[0;34m"
    echo "_________________________________________________________"
    echo ""
    echo -e "Change port (22)? (y/N): \033[0m"
    read -r USE_CUSTOM_PORT
    
    # Establecer el puerto SSH
    if [[ $USE_CUSTOM_PORT =~ ^[Yy]$ ]]; then
        echo -e "\033[0;32mSSH port?: \033[0m"
        read -r SSH_PORT
    else
        SSH_PORT=22
    fi
    
    # Obtener la IP local de la máquina
    MYIP=$(hostname -I | awk '{print $1}')
    
    # Construimos el comando SSHuttle, incluyendo el puerto SSH
    SSHUTTLE_CMD="sshuttle -D --dns -r $REMOTE_HOST:$SSH_PORT --exclude $MYIP 0/0"
    echo -e "\n\033[1;37m_________________________________________________________\033[0m\n"
    
    # Ejecutamos SSHuttle con la redirección de todo el tráfico
    echo -e "\033[0;36mSSHuttle All traffic...\033[0m"
    echo ""
    echo -e "\033[0;33m$SSHUTTLE_CMD\033[0m"
    echo -e "\n\033[1;37m_________________________________________________________\033[0m\n"
    $SSHUTTLE_CMD
    echo ""
    echo -e "\033[0;31mADVISORY: This script should be used for authorized penetration testing and/or educational purposes only. Any misuse of this software will not be the responsibility of the author or of any other collaborator. Use it at your own computers and/or with the computer owner's permission.\033[0m"
    
    
  • Download