#!/bin/sh

# telnet-put program
# put <login> <local_filename_with_path> <remote_name> <remote_machine>

if ( ! which nc > /dev/null )
then
    echo you need the netcat utility to run this program
    echo It is the part of all linux distributions
    echo Just search for it.
    exit -1
fi    

if [ ! $# = 4 ]
then
    echo Usage:
    echo $0 \<login\> \<local_filename_with_path\> \<remote_name\> \<remote_machine\>
    echo Where:
    echo \<login\> is your username to the server
#    echo \<pass\> is your password for your username
    echo \<local_filename_with_path\> is the local file you want to upload
    echo \<remote_name\> is the remote file name. May include some path \(eg. /tmp/joe\)
    echo \<remote_machine\> is the server name
    exit -1
fi
echo enter your pass for $1 and press enter twice. 
PASS=`cat | head -1`  # please send me an elegant way to do this 

(sleep 1;echo -e "$1\n";sleep 1; echo -e "$PASS\n" ;sleep 1; echo -e "uudecode\n";sleep 1;uuencode $3 <$2;cat)|nc -t $4 23

# Well, it needs nc and uuencode on your side, and uudecode on the server side.
# They are quite common...
#
# telnet-getfile.sh comming soon 
#
# If You have any problems
# just throw me an email.
# I'm very happy when getting emails ;)
#
# This program is
# telnet-putfile.sh
# By Lez <lezli@alarmix.net>

