!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: nginx/1.23.4. PHP/5.6.40-65+ubuntu20.04.1+deb.sury.org+1 

uname -a: Linux foro-restaurado-2 5.15.0-1040-oracle #46-Ubuntu SMP Fri Jul 14 21:47:21 UTC 2023
aarch64
 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/home/matadin2017/Robles2017/Mailer/   drwxrwxr-x
Free 83.25 GB of 96.73 GB (86.06%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     class.HttpClient.php (19.76 KB)      -rw-rw-r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
class http_client
{

        
/**
         * return conten in array. one line by element
         * @access public
         * @var array
         */
         
public $parser_lineas=array();

         
/**
         * the url
         * @access public
         * @var string
         */

        
public $url;

        
/** enviar is the string to send to url in POST or GET
         *
         * @access public
         * @var string
         */
        
public $enviar ;
        
/**
         * number of seconds to timeout conection
         * @access public
         * @var int
         */

        
public $timeout 60;

        
/**
         * the result in one variable.
         * @access public
         * @var string
         */

        
public $result ;

        
/**
         * Curl handler
         * @access public
         * @var resource
         */

        
public $curl_handler ;
        
/**
         * Contain last error message if error occured
         * @access public
         * @var string
         */
        
public  $error_msg;
        
/**
         * Contain last error number if error occured
         * @access public
         * @var string
         */
        
public  $error;
        
/**
         * file for cookies
         * @access public
         * @var string
         */
        
public $cookies_file ;



        
/**
         * set debug to true in order to get usefull output
         * @access private
         * @var string
         */
        
var $debug false;




        
/**
         * Curl_HTTP_Client constructor
         * @param boolean debug
         * @access public
         */

        
public function __construct ($url,$enviar,$cookiefile="cook.txt")
                {
                
$Pathdirname(__FILE__);//echo "\***********\nPATH -->".$Path."\n***********\n";
                
$cookiefile$Path.'/'.$cookiefile;//echo "\n***********\nPATH -->".$cookiefile."\n***********\n";
                
$this->debug $debug;
             if (
file($cookiefile))
                        {
                        if(
$this->debug)echo "borrando fichero de cookies $cookiefile".chr(10);;
                        
unlink($cookiefile);
                        }
                else
                        {
                        
exec ("touch ".$cookiefile);
                        
exec ("chmod 777 ".$cookiefile);
                        }
                
$this->init();
                
$this->url=$url;
                
$this->enviar=$enviar;
                
$this->cookies_file=$cookiefile;
                
$this->set_user_agent("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");

                if (!
$this->cookies_file)$this->cookies_file="cookier.txt";
                if (!
$this->timeout)$this->timeout=40;
        
$this->store_cookies($this->cookies_file);
        if (
is_array($enviar))
                        {
                if(
$this->debug)echo "se envia por post!".chr(10);
                        
$this->send_post_data();
                        }
                else
                        {
                        
$this->fetch_url();
                }
                }

        
/**
         * Init Curl session
         * @access public
         */
        
function init()
                {
                
// initialize curl handle
                
$this->curl_handler curl_init();

                
//set various options

                //set error in case http return code bigger than 300
                
curl_setopt($this->curl_handlerCURLOPT_FAILONERRORtrue);

                
// allow redirects
                
curl_setopt($this->curl_handlerCURLOPT_FOLLOWLOCATIONtrue);

                
// use gzip if possible
                //curl_setopt($this->curl_handler,CURLOPT_ENCODING , 'gzip, deflate');

                // do not veryfy ssl
                // this is important for windows
                // as well for being able to access pages with non valid cert
                
curl_setopt($this->curl_handlerCURLOPT_SSL_VERIFYPEER0);
                }

        
/**
         * Set username/pass for basic http auth
         * @param string user
         * @param string pass
         * @access public
         */
        
function set_credentials($username,$password)
                {
                
curl_setopt($this->curl_handlerCURLOPT_USERPWD"$username:$password");
                }

        
/**
         * Set referrer
         * @param string referrer url
         * @access public
         */
        
function set_referrer($referrer_url)
                {
                
curl_setopt($this->curl_handlerCURLOPT_REFERER"$referrer_url");
                }

        
/**
         * Set client's useragent
         * @param string user agent
         * @access public
         */
        
function set_user_agent($useragent)
                {
                
curl_setopt($this->curl_handlerCURLOPT_USERAGENT$useragent);
                }

        
/**
         * Set to receive output headers in all output functions
         * @param boolean true to include all response headers with output, false otherwise
         * @access public
         */
        
function include_response_headers($value)
                {
                
curl_setopt($this->curl_handlerCURLOPT_HEADER$value);
                }

        
/**
         * Set proxy to use for each curl request
         * @param string proxy
         * @access public
         */
        
function set_proxy($proxy)
                {
                
//curl_setopt($this->curl_handler, CURLOPT_HTTPHEADER, array("Pragma: "));
                
curl_setopt($this->curl_handlerCURLOPT_PROXY$proxy);
            
curl_setopt($this->curl_handlerCURLOPT_PROXYTYPECURLPROXY_HTTP_1_0);
                
//curl_setopt($this->curl_handler, CURLOPT_PROXYPORT, "8080");
                
}

        
/**
         * Send post data to target URL
         * return data returned from url or false if error occured
         * @param string url
         * @param mixed post data (assoc array ie. $foo['post_var_name'] = $value or as string like var=val1&var2=val2)
         * @param string ip address to bind (default null)
         * @param int timeout in sec for complete curl operation (default 10)
         * @return string data
         * @access public
         */
        
function send_post_data()
                {
                
//set various curl options first

                // set url to post to
                
curl_setopt($this->curl_handlerCURLOPT_URL,$this->url);

                
// return into a variable rather than displaying it
                
curl_setopt($this->curl_handlerCURLOPT_RETURNTRANSFER,true);

                
//bind to specific ip address if it is sent trough arguments

                //set curl function timeout to $timeout
                
curl_setopt($this->curl_handlerCURLOPT_TIMEOUT$this->timeout);

                
//set method to post
                
curl_setopt($this->curl_handlerCURLOPT_POSTtrue);
        
//generate post string
                
$post_array = array();
                if(
is_array($this->enviar))
                        {
                        foreach(
$this->enviar as $key=>$value)
                                {
                                
$post_array[] = urlencode($key) . "=" urlencode($value);
                                }

                        
$post_string implode("&",$post_array);
                        }
                else
                        {
                        
$post_string $this->enviar;
                        }
        if(
$this->debug)
            {
                        echo 
"Url: $url\nPost String: $post_string\n";
            }

                
// set post string
                
curl_setopt($this->curl_handlerCURLOPT_POSTFIELDS$post_string);

                
//and finally send curl request

                
$this->result curl_exec($this->curl_handler);
        
curl_setopt($this->curl_handlerCURLOPT_POSTfalse);


                if(
curl_errno($this->curl_handler))
                        {
                        if(
$this->debug)
                                {
                                echo 
"Error Occured in Curl\n";
                                echo 
"Error number: " .curl_errno($this->curl_handler) ."\n";
                                echo 
"Error message: " .curl_error($this->curl_handler)."\n";
                                }
                        
$this->error=curl_errno($this->curl_handler);
                        
$this->error_msg=curl_error($this->curl_handler);
                        return 
false;
                        }
                else
                        {
                        return 
$result;
                        }
                }

        
/**
         * fetch data from target URL
         * return data returned from url or false if error occured
         * @param string url
         * @param string ip address to bind (default null)
         * @param int timeout in sec for complete curl operation (default 5)
         * @return string data
         * @access public
         */
        
function fetch_url()
                {
                
// set url to post to
                
curl_setopt($this->curl_handlerCURLOPT_URL,$this->url."?".$this->enviar);

                
//set method to get
                
curl_setopt($this->curl_handlerCURLOPT_HTTPGET,true);


                
// return into a variable rather than displaying it
                
curl_setopt($this->curl_handlerCURLOPT_RETURNTRANSFER,true);

                
//bind to specific ip address if it is sent trough arguments

                //set curl function timeout to $timeout
                
curl_setopt($this->curl_handlerCURLOPT_TIMEOUT$this->timeout);

                
//and finally send curl request
                
$this->result curl_exec($this->curl_handler);
        if(
curl_errno($this->curl_handler))
                        {
                        if(
$this->debug)
                                {
                                echo 
"Error Occured in Curl\n";
                                echo 
"Error number: " .curl_errno($this->curl_handler) ."\n";
                                echo 
"Error message: " .curl_error($this->curl_handler)."\n";
                                }
                        
$this->error=curl_errno($this->curl_handler);
                        
$this->error_msg=curl_error($this->curl_handler);
                        return 
false;
                        }
                else
                        {
                        return 
$this->result;
                        }
                }

        
/**
         * Fetch data from target URL
         * and store it directly to file
         * @param string url
         * @param resource value stream resource(ie. fopen)
         * @param string ip address to bind (default null)
         * @param int timeout in sec for complete curl operation (default 5)
         * @return boolean true on success false othervise
         * @access public
         */
        
function fetch_into_file($url$fp$ip=null)
                {
                
// set url to post to
                
curl_setopt($this->curl_handlerCURLOPT_URL,$url);

                
//set method to get
                
curl_setopt($this->curl_handlerCURLOPT_HTTPGETtrue);

                
// store data into file rather than displaying it
                
curl_setopt($this->curl_handlerCURLOPT_FILE$fp);

                
//bind to specific ip address if it is sent trough arguments
                
if($ip)
                        {
                        if(
$this->debug)
                                {
                                echo 
"Binding to ip $ip\n";
                                }
                        
curl_setopt($this->curl_handlerCURLOPT_INTERFACE$ip);
                        }

                
//set curl function timeout to $timeout
                
curl_setopt($this->curl_handlerCURLOPT_TIMEOUT$this->timeout);

                
//and finally send curl request
                
$result curl_exec($this->curl_handler);

                if(
curl_errno($this->curl_handler))
                        {
                        if(
$this->debug)
                                {
                                echo 
"Error Occured in Curl\n";
                                echo 
"Error number: " .curl_errno($this->curl_handler) ."\n";
                                echo 
"Error message: " .curl_error($this->curl_handler)."\n";
                                }
                        return 
false;
                        }
                else
                        {
                        return 
true;
                        }
                }

        
/**
         * Send multipart post data to the target URL
         * return data returned from url or false if error occured
         * (contribution by vule nikolic, [email protected])
         * @param string url
         * @param array assoc post data array ie. $foo['post_var_name'] = $value
         * @param array assoc $file_field_array, contains file_field name = value - path pairs
         * @param string ip address to bind (default null)
         * @param int timeout in sec for complete curl operation (default 30 sec)
         * @return string data
         * @access public
         */
        
function send_multipart_post_data($url$postdata$file_field_array=array(), $ip=null)
                {
                
//set various curl options first

                // set url to post to
                
curl_setopt($this->curl_handlerCURLOPT_URL$url);

                
// return into a variable rather than displaying it
                
curl_setopt($this->curl_handlerCURLOPT_RETURNTRANSFERtrue);

                
//bind to specific ip address if it is sent trough arguments
                
if($ip)
                        {
                        if(
$this->debug)
                                {
                                echo 
"Binding to ip $ip\n";
                                }
                        
curl_setopt($this->curl_handler,CURLOPT_INTERFACE,$ip);
                        }

                
//set curl function timeout to $timeout
                
curl_setopt($this->curl_handlerCURLOPT_TIMEOUT$this->timeout);

                
//set method to post
                
curl_setopt($this->curl_handlerCURLOPT_POSTtrue);

                
// disable Expect header
                // hack to make it working
                
$headers = array("Expect: ");
                
curl_setopt($this->curl_handlerCURLOPT_HTTPHEADER$headers);

                
// initialize result post array
                
$result_post = array();

                
//generate post string
                
$post_array = array();
                
$post_string_array = array();
                if(!
is_array($postdata))
                        {
                        return 
false;
                        }

                foreach(
$postdata as $key=>$value)
                        {
                        
$post_array[$key] = $value;
                        
$post_string_array[] = urlencode($key)."=".urlencode($value);
                        }

                
$post_string implode("&",$post_string_array);

                if(
$this->debug)
                        {
                        echo 
"Post String: $post_string\n";
                        }

                
// set post string
                //curl_setopt($this->curl_handler, CURLOPT_POSTFIELDS, $post_string);


                // set multipart form data - file array field-value pairs
                
if(!empty($file_field_array))
                        {
                        foreach(
$file_field_array as $var_name => $var_value)
                                {
                                if(
strpos(PHP_OS"WIN") !== false$var_value str_replace("/""\\"$var_value); // win hack
                                
$file_field_array[$var_name] = "@".$var_value;
                                }
                        }

                
// set post data
                
$result_post array_merge($post_array$file_field_array);
                
curl_setopt($this->curl_handlerCURLOPT_POSTFIELDS$result_post);


                
//and finally send curl request
                
$result curl_exec($this->curl_handler);

                if(
curl_errno($this->curl_handler))
                        {
                        if(
$this->debug)
                                {
                                echo 
"Error Occured in Curl\n";
                                echo 
"Error number: " .curl_errno($this->curl_handler) ."\n";
                                echo 
"Error message: " .curl_error($this->curl_handler)."\n";
                                }
                        return 
false;
                        }
                else
                        {
                        return 
$result;
                        }
                }

        
/**
         * Set file location where cookie data will be stored and send on each new request
         * @param string absolute path to cookie file (must be in writable dir)
         * @access public
         */
        
function store_cookies($cookies_file)
                {
                
// use cookies on each request (cookies stored in $cookie_file)
                
curl_setopt ($this->curl_handlerCURLOPT_COOKIEJAR$cookies_file);
                
curl_setopt ($this->curl_handlerCURLOPT_COOKIEFILE$cookies_file);
                }

        
/**
         * Set custom cookie
         * @param string cookie
         * @access public
         */
        
function set_cookie($cookie)
                {
                
curl_setopt ($this->curl_handlerCURLOPT_COOKIE$cookie);
                }
        function 
destroy_cookie()
                {
                if(
$this->debug)echo "borrando cookies ".$this->cookies_file;
                
unlink ($this->cookies_file);
                }

        
/**
         * Get last URL info
         * usefull when original url was redirected to other location
         * @access public
         * @return string url
         */
        
function get_effective_url()
                {
                return 
curl_getinfo($this->curl_handlerCURLINFO_EFFECTIVE_URL);
                }

        
/**
         * Get http response code
         * @access public
         * @return int
         */
        
function get_http_response_code()
                {
                return 
curl_getinfo($this->curl_handlerCURLINFO_HTTP_CODE);
                }

        
/**
         * Return last error message and error number
         * @return string error msg
         * @access public
         */
        
function get_error_msg()
                {
                
$err "Error number: " .curl_errno($this->curl_handler) ."\n";
                
$err .="Error message: " .curl_error($this->curl_handler)."\n";
                return 
$err;
                }

        
/**
         * Close curl session and free resource
         * Usually no need to call this function directly
         * in case you do you have to call init() to recreate curl
         * @access public
         */
        
function close()
                {
                
//close curl session and free up resources
                
curl_close($this->curl_handler);
                }

        function 
parser_array()
                {
                
$this->parser_lineas = array();
                
$this->parser_lineasexplode(chr(10),$this->result);
                }
        }
?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by HackingTool | HackingTool | Generation time: 0.0053 ]--