home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / sbin / securetelnetshell < prev    next >
Encoding:
Text File  |  2004-03-27  |  1.8 KB  |  56 lines

  1. #!/bin/sh
  2. #frontend for ssh, secure telnet.
  3. #(c) Barry Kauler 2004 www.goosee.com/puppy
  4.  
  5. . /etc/securetelnetrc
  6. HDRMSG="#Configuration file for secure telnet. See Network menu."
  7.  
  8. while [ 1 ]
  9. do
  10.  
  11. RETSTR=`Xdialog --wmclass "securetelnet" --title "Secure telnet" --stdout --left --separator "|" --help "" --3inputsbox "ssh can be used for secure remote login,\ninvoked with the format:\n ssh -l username -p port hostname\nI suggest try port 22, if not known." 0 0 "Hostname:" "$SSHHOSTNAME" "Port:" "$SSHPORT" "Username:" "$SSHUSERNAME"`
  12.  
  13. RETVAL=$?
  14. case $RETVAL in
  15.  0) #ok
  16.   RETHOSTNAME=`echo -n "$RETSTR" | cut -f 1 -d "|"`
  17.   RETPORT=`echo -n "$RETSTR" | cut -f 2 -d "|"`
  18.   RETUSERNAME=`echo -n "$RETSTR" | cut -f 3 -d "|"`
  19.    echo "$HDRMSG" > /etc/securetelnetrc
  20.    echo "SSHHOSTNAME=\"${RETHOSTNAME}\"" >> /etc/securetelnetrc
  21.    echo "SSHPORT=\"${RETPORT}\"" >> /etc/securetelnetrc
  22.    echo "SSHUSERNAME=\"${RETUSERNAME}\"" >> /etc/securetelnetrc
  23.  
  24.     echo '#!/bin/sh' > /tmp/runssh.sh
  25.     echo -e "ssh -l $RETUSERNAME -p $RETPORT $RETHOSTNAME 2>/tmp/scratch1.txt" >> /tmp/runssh.sh
  26.     echo 'if [ ! $? -eq 0 ];then' >> /tmp/runssh.sh
  27.     echo -e "ERRSTR=\"\`cat /tmp/scratch1.txt\`\"" >> /tmp/runssh.sh
  28.     echo -en "Xdialog --wmclass \"securetelnet\" --title \"Secure telnet\" --infobox \"Failed to execute:" >> /tmp/runssh.sh
  29.     echo -n '\n' >> /tmp/runssh.sh
  30.     echo -n " ssh -l $RETUSERNAME -p $RETPORT $RETHOSTNAME" >> /tmp/runssh.sh
  31.     echo -n '\n' >> /tmp/runssh.sh
  32.     echo -n "ssh error message:" >> /tmp/runssh.sh
  33.     echo -n '\n' >> /tmp/runssh.sh
  34.     echo '$ERRSTR" 0 0 40000' >> /tmp/runssh.sh
  35.     echo 'fi' >> /tmp/runssh.sh
  36.     sync
  37.     chmod 755 /tmp/runssh.sh
  38.  
  39.   rxvt -bg "#ff80e0" -name "securetelnet" -title "Secure telnet" -e "/tmp/runssh.sh"
  40.   break
  41.   ;;
  42.  1) #cancel
  43.   break
  44.   ;;
  45.  2) #help
  46.   dillo file:///usr/share/doc/ssh.htm &
  47.   ;;
  48.  *)
  49.   break
  50.   ;;
  51. esac
  52.  
  53.  
  54. done
  55.  
  56.