Server IP : 103.119.228.120 / Your IP : 18.119.124.52 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/share/zsh/5.0.2/functions/ |
Upload File : |
# Open a TCP session, add it to the list, handle it with zle if that's running. # Unless using -a, -f, -l or -s, first two arguments are host and port. # # Remaining argument, if any, is the name of the session, which mustn't # clash with an existing one. If none is given, the number of the # connection is used (i.e. first connection is 1, etc.), or the first # available integer if that is already in use. # # Session names, whether provided on the command line or in the # .ztcp_sessions file should not be `clever'. A clever name is one # with characters that won't work. This includes whitespace and an # inconsistent set of punctuation characters. If in doubt, stick # to alphanumeric, underscore and non-initial hyphen. # # -a fd Accept a connection on fd and make that the session. # This will block until a successful incoming connection is received. # # fd is probably a value returned by ztcp -l; no front-end # is currently provided for that but it should simply be # a matter of calling `ztcp -l port' and storing $REPLY, then # closing the listened port with `ztcp -c $stored_fd'. # # -f fd `Fake' tcp connection on the given file descriptor. This # could be, for example, a file descriptor already opened to # a named pipe. It should not be a regular file, however. # Note that it is not a good idea for two different sessions # to be attempting to read from the same named pipe, so if # both ends of the pipe are to be handled by zsh, at least # one should use the `-z' option. # # -l sesslist # -s sessname # Open by session name or comma separated list; either may # be repeated as many times as necessary. The session must be # listed in the file ${ZDOTDIR:-$HOME}/.ztcp_sessions. Lines in # this file look exactly like a tcp_open command line except the # session name is at the start, for example # sess1 pwspc 2811 # has the effect of # tcp_open pwspc 2811 sess1 # Remaining arguments (other than options) to tcp_open are # not allowed. Options in .ztcp_sessions are not handled. # The file must be edited by hand. # # -z Don't install a zle handler for reading on the file descriptor. # Otherwise, if zle is enabled, the file descriptor will # be tested while at the shell prompt and any input automatically # printed in the same way as job control notification. # # If a session is successfully opened, and if the function `tcp_on_open' # exists, it is run with the arguments session_name, session_fd. emulate -L zsh setopt extendedglob cbases # Global set up for TCP function suite. zmodload -i zsh/net/tcp || return 1 zmodload -i zsh/zutil autoload -Uz tcp_alias tcp_close tcp_command tcp_expect tcp_fd_handler autoload -Uz tcp_log tcp_output tcp_proxy tcp_read tcp_rename tcp_send autoload -Uz tcp_sess tcp_spam tcp_talk tcp_wait tcp_point tcp_shoot # TCP_SECONDS_START is only set if we override TCP_SECONDS locally, # so provide a global value for convenience. Should probably always be 0. (( ${+TCP_SECONDS_START} )) || typeset -gF TCP_SECONDS_START # Processing for new connection. local opt accept fake nozle sessfile sess quiet local -a sessnames sessargs integer stat while getopts "a:f:l:qs:z" opt; do case $opt in (a) accept=$OPTARG if [[ $accept != [[:digit:]]## ]]; then print "option -a takes a file descriptor" >&2 return 1 fi ;; (f) fake=$OPTARG if [[ $fake != [[:digit:]]## ]]; then print "option -f takes a file descriptor" >&2 return 1 fi ;; (l) sessnames+=(${(s.,.)OPTARG}) ;; (q) quiet=1 ;; (s) sessnames+=($OPTARG) ;; (z) nozle=1 ;; (*) return 1 ;; esac done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) (( ${+tcp_by_fd} )) || typeset -gA tcp_by_fd (( ${+tcp_by_name} )) || typeset -gA tcp_by_name typeset -A sessassoc if (( ${#sessnames} )); then if [[ $# -ne 0 || -n $accept || -n $fake ]]; then print "Incompatible arguments with \`-s' option." >&2 return 1 fi for sess in ${sessnames}; do sessassoc[$sess]= done sessfile=${ZDOTDIR:-$HOME}/.ztcp_sessions if [[ ! -r $sessfile ]]; then print "No session file: $sessfile" >&2 return 1 fi while read -A sessargs; do [[ ${sessargs[1]} = '#'* ]] && continue if (( ${+sessassoc[${sessargs[1]}]} )); then sessassoc[${sessargs[1]}]="${sessargs[2,-1]}" fi done < $sessfile for sess in ${sessnames}; do if [[ -z $sessassoc[$sess] ]]; then print "Couldn't find session $sess in $sessfile." >&2 return 1 fi done else if [[ -z $accept && -z $fake ]]; then if (( $# < 2 )); then set -- wrong number of arguments else host=$1 port=$2 shift $(( $# > 1 ? 2 : 1 )) fi fi if [[ -n $1 ]]; then sessnames=($1) shift else sessnames=($(( ${#tcp_by_fd} + 1 ))) while [[ -n $tcp_by_name[$sessnames[1]] ]]; do (( sessnames[1]++ )) done fi sessassoc[$sessnames[1]]="$host $port" fi if (( $# )); then print "Usage: $0 [-z] [-a fd | -f fd | host port [ session ] ] $0 [-z] [ -s session | -l sesslist ] ..." >&2 return 1 fi local REPLY fd for sess in $sessnames; do if [[ -n $tcp_by_name[$sess] ]]; then print "Session \`$sess' already exists." >&2 return 1 fi sessargs=() if [[ -n $fake ]]; then fd=$fake; else if [[ -n $accept ]]; then ztcp -a $accept || return 1 else sessargs=(${=sessassoc[$sess]}) ztcp $sessargs || return 1 fi fd=$REPLY fi tcp_by_fd[$fd]=$sess tcp_by_name[$sess]=$fd [[ -o zle && -z $nozle ]] && zle -F $fd tcp_fd_handler # needed for new completion system, so I'm not too sanguine # about requiring this here... if zmodload -i zsh/parameter; then if (( ${+functions[tcp_on_open]} )); then if ! tcp_on_open $sess $fd; then if [[ -z $quiet ]]; then if (( ${#sessargs} )); then print "Session $sess" \ "(host $sessargs[1], port $sessargs[2] fd $fd): tcp_on_open FAILED." else print "Session $sess (fd $fd) tcp_on_open FAILED." fi tcp_close -- $sess else tcp_close -q -- $sess fi stat=1 continue fi fi fi if [[ -z $quiet ]]; then if (( ${#sessargs} )); then print "Session $sess" \ "(host $sessargs[1], port $sessargs[2] fd $fd) opened OK." else print "Session $sess (fd $fd) opened OK." fi fi done if [[ -z $TCP_SESS || -z $tcp_by_name[$TCP_SESS] ]]; then # careful in case we closed it again... if [[ -n $tcp_by_name[$sessnames[1]] ]]; then [[ -z $quiet ]] && print "Setting default TCP session $sessnames[1]" typeset -g TCP_SESS=$sessnames[1] fi fi return $stat