!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/apex_tdfonline/php/lib/rest/http/   drwxr-xr-x
Free 13.33 GB of 61.93 GB (21.52%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     request.php (5.17 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace rest\http;

use 
rest\lib\rest_error;

/**
 * Clase basada en Slim - a micro PHP 5 framework para abstraer el Request
 */
class request
{
    const 
METHOD_HEAD 'HEAD';
    const 
METHOD_GET 'GET';
    const 
METHOD_POST 'POST';
    const 
METHOD_PUT 'PUT';
    const 
METHOD_PATCH 'PATCH';
    const 
METHOD_DELETE 'DELETE';
    const 
METHOD_OPTIONS 'OPTIONS';
    const 
METHOD_OVERRIDE '_METHOD';


    
/**
     * Special-case HTTP headers that are otherwise unidentifiable as HTTP headers.
     * Typically, HTTP headers in the $_SERVER array will be prefixed with
     * `HTTP_` or `X_`. These are not so we list them here for later reference.
     *
     * @var array
     */
    
protected static $special = array(
        
'CONTENT_TYPE',
        
'CONTENT_LENGTH',
        
'PHP_AUTH_USER',
        
'PHP_AUTH_PW',
        
'PHP_AUTH_DIGEST',
        
'AUTH_TYPE'
    
);

    protected 
$union//get + post
    
protected $body;

    public 
$headers;

    protected 
$encoding;


    public function 
__construct()
    {
        
$this->headers $this->extract_headers();
    }

    public function 
set_encoding_datos($encoding)
    {
        
$this->encoding $encoding;
    }

    public function 
get_encoding_datos()
    {
        return 
$this->encoding;
    }


    public function 
get_method()
    {
        return 
$_SERVER['REQUEST_METHOD'];
    }


    
/**
     * Obtiene parametros del $_GET o $_POST unidos
     *
     * Si key es nulo devuelve todos. Sino devuelve el parametro key si existe o su default
     */
    
public function params($key null$default null)
    {
        if (!
$this->union) {
            
$this->union array_merge($this->get(), $this->post());
        }
        return 
$this->get_valor_o_default($this->union$key$default);
    }

    
/**
     * Devuelve parametros del _GET
     *
     * Si key es nulo devuelve todos. Sino devuelve el parametro key si existe o su default
     *
     */
    
public function get($key null$default null)
    {
        return 
$this->get_valor_o_default($_GET$key$default);
    }

    
/**
     * Devuelve parametros del _POST - Solo se setea para formularios html
     *
     * Si key es nulo devuelve todos. Sino devuelve el parametro key si existe o su default
     */
    
public function post($key null$default null)
    {
        
$datos $this->get_valor_o_default($_POST$key$default);
        return 
$this->manejar_encoding($datos);
    }

    
/**
     * Devuelve parametros del POST en formato json como un arreglo
     *
     */
    
function get_body_json()
    {
        
$body $this->get_body();
        
$json json_decode($bodytrue);
        if(
$body && NULL === $json){
            throw new 
rest_error(400"No se pudo decodificar el mensaje '$body'");
        }
        
$arreglo $this->manejar_encoding($json);
        return 
$arreglo;
    }

    
/**
     * Devuelve los headers
     *
     * Si key es nulo devuelve todos. Sino devuelve el parametro key si existe o su default
     */
    
public function headers($key null$default null)
    {
        return 
$this->get_valor_o_default($this->headers$key$default);
    }

    
/**
     * Retorna el body en crudo - Usar cuando no aplica el $_POST get_post()
     * @return string
     */
    
public function get_body()
    {
        if (!
$this->body) {
            
$this->body file_get_contents('php://input');
            if (!
$this->body) {
                
$this->body '';
            }
        }
        return 
$this->body;
    }

    
/**
     * Get Host
     * @return string
     */
    
public function get_host()
    {
        if (isset(
$_SERVER['HTTP_HOST'])) {
            if (
strpos($_SERVER['HTTP_HOST'], ':') !== false) {
                
$hostParts explode(':'$_SERVER['HTTP_HOST']);

                return 
$hostParts[0];
            }

            return 
$_SERVER['HTTP_HOST'];
        }

        return 
$_SERVER['SERVER_NAME'];
    }


    
/**
     * Get Port
     * @return int
     */
    
public function get_puerto()
    {
        return (int) 
$_SERVER['SERVER_PORT'];
    }

    
/**
     * Devuelve el esquema (https or http)
     * @return string
     */
    
public function get_esquema()
    {
        return empty(
$_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off' 'http' 'https';
    }

    
/**
     *  URL (schema + host [ + port si no es 80 ])
     * @return string
     */
    
public function get_url()
    {
        
$url $this->get_esquema() . '://' $this->get_host();
        if ((
$this->get_esquema() === 'https' && $this->get_puerto() !== 443) || ($this->get_esquema() === 'http' && $this->get_puerto() !== 80)) {
            
$url .= sprintf(':%s'$this->get_puerto());
        }

        return 
$url;
    }

    public function 
get_request_uri()
    {
        return 
$_SERVER["REQUEST_URI"];
    }

    protected function 
extract_headers()
    {
        
$results = array();
        foreach (
$_SERVER as $key => $value) {
            
$key strtoupper($key);
            if (
strpos($key'X_') === || strpos($key'HTTP_') === || in_array($key, static::$special)) {
                if (
$key === 'HTTP_CONTENT_TYPE' || $key === 'HTTP_CONTENT_LENGTH') {
                    continue;
                }
                
$results[$key] = $value;
            }
        }

        return 
$results;
    }

    protected function 
get_valor_o_default($arreglo$key null$default null)
    {
        if (
$key) {
            if (isset(
$arreglo[$key])) {
                return 
$arreglo[$key];
            } else {
                return 
$default;
            }
        } else {
            return 
$arreglo;
        }
    }


    protected function 
manejar_encoding($datos)
    {
        if(
$this->encoding !== 'utf-8'){
            
$datos $this->utf8_decode_fields($datos);
        }

        return 
$datos;
    }

    protected function 
utf8_decode_fields($entrada)
    {
        if (
is_array($entrada)) {
            
$salida = array();
            foreach (
$entrada as $clave => $valor) {
                
$salida[$clave] = $this->utf8_decode_fields($valor);
            }
            return 
$salida;
        } elseif (
is_string($entrada)) {
            return 
utf8_decode($entrada);
        } else {
            return 
$entrada;
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.6052 ]--