!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)

/usr/libexec/netdata/python.d/   drwxr-xr-x
Free 13.25 GB of 57.97 GB (22.85%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     hddtemp.chart.py (2.39 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# -*- coding: utf-8 -*-
# Description: hddtemp netdata python.d module
# Author: Pawel Krupa (paulfantom)
# Author: Ilya Mashchenko (ilyam8)
# SPDX-License-Identifier: GPL-3.0-or-later


import re
from copy import deepcopy

from bases.FrameworkServices.SocketService import SocketService

ORDER = [
    'temperatures',
]

CHARTS = {
    'temperatures': {
        'options': ['disks_temp', 'Disks Temperatures', 'Celsius', 'temperatures', 'hddtemp.temperatures', 'line'],
        'lines': [
            # lines are created dynamically in `check()` method
        ]}}

RE = re.compile(r'\/dev\/([^|]+)\|([^|]+)\|([0-9]+|SLP|UNK)\|')


class Disk:
    def __init__(self, id_, name, temp):
        self.id = id_.split('/')[-1]
        self.name = name.replace(' ', '_')
        self.temp = temp if temp.isdigit() else None

    def __repr__(self):
        return self.id


class Service(SocketService):
    def __init__(self, configuration=None, name=None):
        SocketService.__init__(self, configuration=configuration, name=name)
        self.order = ORDER
        self.definitions = deepcopy(CHARTS)
        self.do_only = self.configuration.get('devices')
        self._keep_alive = False
        self.request = ""
        self.host = "127.0.0.1"
        self.port = 7634

    def get_disks(self):
        r = self._get_raw_data()

        if not r:
            return None

        m = RE.findall(r)

        if not m:
            self.error("received data doesn't have needed records")
            return None

        rv = [Disk(*d) for d in m]
        self.debug('available disks: {0}'.format(rv))

        if self.do_only:
            return [v for v in rv if v.id in self.do_only]
        return rv

    def get_data(self):
        """
        Get data from TCP/IP socket
        :return: dict
        """

        disks = self.get_disks()

        if not disks:
            return None

        return dict((d.id, d.temp) for d in disks)

    def check(self):
        """
        Parse configuration, check if hddtemp is available, and dynamically create chart lines data
        :return: boolean
        """
        self._parse_config()
        disks = self.get_disks()

        if not disks:
            return False

        for d in disks:
            dim = [d.id]
            self.definitions['temperatures']['lines'].append(dim)

        return True

    @staticmethod
    def _check_raw_data(data):
        return not bool(data)

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