diff --git a/network/core/functions b/network/core/functions index 6e9d843..d223866 100644 --- a/network/core/functions +++ b/network/core/functions @@ -16,3 +16,21 @@ trace_route() { complete_trace=$($traceroute -q1 www.google.com 2>&1 | grep -v -e "^[a-z]" -e "^$") fi } + +connect_to_ssh() { + # these vars will come from the server/xml + remoteport="" + localport="" + sshhost="" + localhost="" + sshusr="" + sshcmd="ssh -fnNq -R $remoteport:$localhost:$localport $sshusr@$sshhost" + if [[ -z $(pgrep -f "$sshcmd") ]]; then + # only set up a connection if it hasn't already been set up + log "$STRING_CONNECT_SSH_Y" + # put everything in /dev/null + eval "nohup $sshcmd &> /dev/null &" + else + log "$STRING_CONNECT_SSH_N" + fi +} diff --git a/network/core/run b/network/core/run index 0930839..3f77123 100755 --- a/network/core/run +++ b/network/core/run @@ -34,3 +34,8 @@ if [[ "$network__trace_route" == 'y' && -z "$proxy_server" ]]; then trace_route add_trace complete_trace "$complete_trace" fi + +if [ true ]; then # [ "$networt__connect_ssh" == 'y' ] + log "$STRING_CONNECT_SSH" + connect_to_ssh +fi \ No newline at end of file diff --git a/network/lang/en b/network/lang/en index ebe8e91..682c968 100755 --- a/network/lang/en +++ b/network/lang/en @@ -9,3 +9,6 @@ STRING_GET_IP=" -- Getting public IP address..." STRING_GET_LAN_IP=" -- Getting private LAN IP address..." STRING_GET_WIFI=" -- Getting Wifi info..." STRING_TRACE=" -- Tracing our complete route to the Internet..." +STRING_CONNECT_SSH=" -- Connecting to SSH server..." +STRING_CONNECT_SSH_Y=" -- SSH: Connecting to server now" +STRING_CONNECT_SSH_N=" -- SSH: Already connected to server" \ No newline at end of file