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

Software: Apache. PHP/8.3.27 

uname -a: Linux pdx1-shared-a4-04 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64 

uid=6659440(dh_z2jmpm) gid=2086089(pg10499364) groups=2086089(pg10499364)  

Safe-mode: OFF (not secure)

/usr/local/bin/zabbix/   drwxr-xr-x
Free 712.04 GB of 879.6 GB (80.95%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     discover_temp_sensor.pl (1.42 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |

# TODO add getops - pass sensor name to get temp ?

# TODO see about replacing this by having zabbix connect to IPMI directly.

use strict;
use warnings;
use Getopt::Long;

my $query;
GetOptions(
    "s|sensor=s" => \$query,
);

sub exit_empty {
  print '{ "data": [] }';
  exit;
}

my $ipmi = "/usr/bin/ipmitool";
# Check whether this machine has ipmi or not.
(-e "/dev/ipmi0") || exit_empty();
(-e $ipmi) || exit_empty();

my %sensors;

my $command = $ipmi . " sdr elist full 2>/dev/null | grep degrees";
my $output = qx($command);

# Gather all the data
my @lines = split /\n/, $output; # Splits output on new lines
for my $line (@lines) {
    $line =~ s/\h+/ /g; # Removes extra white spaces
    # Expected line format example:
    # Outlet_TEMP      | 42h | ok  | 66.2 | 52 degrees C
    my @line_fields = split / \Q| /, $line; # Fields are separated by ' | '
    my $sensor_name = $line_fields[0];
    my $temperature = $line_fields[4];
    $temperature =~ s/\s+.*$//; # strip off ' degrees C'
    $sensors{$sensor_name} = $temperature;
}

# If a sensor name was passed in, return its temperature and quit.
if ($query) {
    print $sensors{$query};
    exit;
}

# json-ify the sensor names for zabbix discovery
my $json = qq({ "data": [\n);
for my $sensor (keys %sensors) {
    $json .= qq(    { "{#TEMPSENSOR}":"$sensor"},\n);
}
# trim the last ',' off, json doesn't like trailing commas
$json =~ s/,\n$/\n/;
# close up shop
$json .= qq(]}\n);

print $json;

exit;

:: 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.0644 ]--