Server IP : 127.0.0.2 / Your IP : 3.137.152.81 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/netcat-openbsd/examples/ |
Upload File : |
#! /bin/sh ## Like "rcp" but uses netcat on a high port. ## do "ncp targetfile" on the RECEIVING machine ## then do "ncp sourcefile receivinghost" on the SENDING machine ## if invoked as "nzp" instead, compresses transit data. ## pick your own personal favorite port, which will be used on both ends. ## You should probably change this for your own uses. MYPORT=23456 ## if "nc" isn't systemwide or in your PATH, add the right place # PATH=${HOME}:${PATH} ; export PATH test "$3" && echo "too many args" && exit 1 test ! "$1" && echo "no args?" && exit 1 me=`echo $0 | sed 's+.*/++'` test "$me" = "nzp" && echo '[compressed mode]' # if second arg, it's a host to send an [extant] file to. if test "$2" ; then test ! -f "$1" && echo "can't find $1" && exit 1 if test "$me" = "nzp" ; then compress -c < "$1" | nc -v -w 2 $2 $MYPORT && exit 0 else nc -v -w 2 $2 $MYPORT < "$1" && exit 0 fi echo "transfer FAILED!" exit 1 fi # fall here for receiver. Ask before trashing existing files if test -f "$1" ; then echo -n "Overwrite $1? " read aa test ! "$aa" = "y" && echo "[punted!]" && exit 1 fi # 30 seconds oughta be pleeeeenty of time, but change if you want. if test "$me" = "nzp" ; then nc -v -w 30 -p $MYPORT -l < /dev/null | uncompress -c > "$1" && exit 0 else nc -v -w 30 -p $MYPORT -l < /dev/null > "$1" && exit 0 fi echo "transfer FAILED!" # clean up, since even if the transfer failed, $1 is already trashed rm -f "$1" exit 1