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

Software: Apache/2.2.22 (Debian). PHP/5.6.36 

uname -a: Linux h05.hvosting.ua 4.9.110-amd64 #3 SMP Sun Nov 4 16:27:09 UTC 2018 x86_64 

uid=1389(h33678) gid=1099(h33678) groups=1099(h33678),502(mgrsecure) 

Safe-mode: OFF (not secure)

/root/scripts/zabbix/   drwxr-xr-x
Free 1.49 GB of 7.22 GB (20.66%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     sspp.php (5.12 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
# sspp.php ( Server Status PHP Parser )

#########################################################################
# Version 0.1 Created by Serghey Rodin  skid@linux.md                   #
# Version 0.2 Modded by Alexandr Chalpet chalpet@ceonex.com             #
# Version 0.3 Modded by Dmitry Naumov Socolov naumov.socolov@gmail.com  #
# Version 0.4 Modded by Egor golden@ceonex.com                          #
#                                                                       #
# This script is freely distributable under the                         #
# GNU GENERAL PUBLIC LICENSE Version 3                                  #
# http://www.gnu.org/licenses/gpl-3.0.txt                               #
# ##################################################################### #

# If you want to contribute, please welcome :)

# Temporary file path
define('FILE''/tmp/sspp.raw');

# Hiding errors
error_reporting('E_NONE');

# Ucoment this if you are developer
//error_reporting(E_ALL);

########################
# :: Function List ::  #
########################

# Get server-status
function get_status($url)
{
    
# Defining error messages
    
$error_message1 " Sorry, can't work with empty url";
    
$error_message2 " Sorry, can't parse this url... shame on me";
    
$error_message3 " Sorry, I've got an error from web-server";
    
$error_message4 " Sorry, can't write to".FILE.". Check permissions";

    
# Cheking server-status url
    # Ok, I do not know how to work httpd error codes and file_get_contents
    # I hope someday I will make error handler for webserver respones too.
    
if(empty($url))
    {
        echo 
$error_message1;
        exit;
    }

    
# Trying to get server-status
    
if( false == ($str=file_get_contents($url)))
    {
        echo 
$error_message3;
        exit;
    }

    
$str str_replace("\r"""$str);     # removing \r
    
$str str_replace("\n"""$str);     # removing \n

    # Eah big regexp... we just need field values from server-status
    
$reg='~<tr><td><b>(.*)<\/b><\/td><td>(.*)<\/td><td>(.*)<\/td>';
    
$reg.='<td>(.*)<\/td><td>(.*)<\/td><td>(.*)<\/td><td>(.*)<\/td>';
    
$reg.='<td>(.*)<\/td><td>(.*)<\/td><td>(.*)<\/td><td>(.*)<\/td>';
    
$reg.='<td nowrap>(.*)<\/td><td nowrap>(.*)<\/td><\/tr>~Ui';
    
preg_match_all($reg$str$matches);

    
# Checking how many records we found.
    # Simple handler, but it works sometime
    
$c count($matches[0]);
    if( 
$c == )
    {
        echo 
$error_message2;
        exit;
    }

    
# Checking file permissions
    
if( false == ($f fopen(FILE,'w')))
    {
        echo 
$error_message4;
        exit;
    }

    
# Wheeee... filling arrays 
    
for($i=1;$i<$c;$i++)
    {
        
$out['result'][$i]['srv'] = $matches[1][$i];
        
$out['result'][$i]['pid'] = $matches[2][$i];
        
$out['result'][$i]['acc'] = $matches[3][$i];
        
$out['result'][$i]['m'] = $matches[4][$i];
        
$out['result'][$i]['cpu'] = $matches[5][$i];
        
$out['result'][$i]['ss'] = $matches[6][$i];
        
$out['result'][$i]['req'] = $matches[7][$i];
        
$out['result'][$i]['conn'] = $matches[8][$i];
        
$out['result'][$i]['child'] = $matches[9][$i];
        
$out['result'][$i]['slot'] = $matches[10][$i];
        
$out['result'][$i]['client'] = $matches[11][$i];
        
$out['result'][$i]['vhost'] = $matches[12][$i];
        
$out['result'][$i]['request'] = $matches[13][$i];

        
# We will need this array later for uniq sort
        //$out['counts']['vhosts'][$matches[12][$i]]++;
        //$out['counts']['clients'][$matches[11][$i]]++;
        //$out['counts']['requests'][$matches[13][$i]]++;
    
}

    
# Analiser stuff that makes administrators happy
    # We just sorting arrays btw
    //arsort($out['counts']['vhosts']);
    //arsort($out['counts']['clients']);
    //arsort($out['counts']['requests']);

    # Now we will concatenate arrays
    
$arr_str serialize($out);

    
# Writing to temporary file
    
fwrite($f$arr_str);
    
fclose($f);
}


# Show server-status
function show_status($sort)
{

    
# Parsing temp file with server-status data
    
$requests_arr unserialize(file_get_contents(FILE));

    
# Getting sort variable
    //if(isset($_GET['sort']) && $_GET['sort']) $sort = $_GET['sort'];
    //else $sort = 'cpu';

    # Creating new array and sorting it by user request
    
foreach($requests_arr['result'] as $request)
        
$sortAux[] = $request[$sort];

    
# Set proper search type for sort
    
switch ($sort)
    {
        case 
'srv';    # Child Server number - generation
        
case 'pid';    # OS process ID
        
case 'acc';    # Number of accesses this connection
        
case 'cpu';    # CPU usage, number of seconds
        
case 'ss';    # Seconds since beginning of most recent request
        
case 'req';    # Milliseconds required to process most recent request
        
case 'conn';    # Kilobytes transferred this connection
        
case 'child';    # Megabytes transferred this child
        
case 'slot';    # Total megabytes transferred this slot

        
array_multisort($sortAuxSORT_ASC$requests_arr['result']);
        break;
        case 
'm';    # Mode of operation
        
case 'client';    # Client's ip address
        
case 'vhost';    # VirtualHost name
        
case 'request';    # HTTP request string

        
array_multisort($sortAuxSORT_STRING$requests_arr['result']);
        break;
    }

    global 
$count;
    
# And print server-status array
    
foreach($requests_arr['result'] as $request)
    {
        if (
$request['m'] == '<b>W</b>' && stristr($request['request'],'ispmgr'))
            
$count++;
    }
}

$count 0;
$url 'http://localhost:8080/server-status';
get_status($url);
show_status('cpu');

echo 
$count;

:: 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 PinoyWH1Z | C99Shell Github | Generation time: 0.0092 ]--