403Webshell
Server IP : 66.29.132.122  /  Your IP : 18.118.28.112
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/contracts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/contracts/sentry.py
from subprocess import DEVNULL, CalledProcessError, check_output
from typing import Any


from defence360agent.utils import stub_unexpected_error


def _run_cmd(cmd):
    try:
        out = check_output(cmd, stderr=DEVNULL)
    except (FileNotFoundError, CalledProcessError):
        return None

    return out.decode("utf-8", errors="ignore").strip()


@stub_unexpected_error
def _get_virtualization_type():
    systemd_virt = _run_cmd(["systemd-detect-virt"])
    if systemd_virt:
        return systemd_virt

    virt_what = _run_cmd(["virt-what"])
    if virt_what:
        return virt_what

    demicode = _run_cmd(["dmidecode", "-s", "system-manufacturer"])
    if demicode:
        return demicode

    return "fail to detect"


@stub_unexpected_error
def _get_total_ram():
    import psutil

    return psutil.virtual_memory().total // 2**20


_TAGS = None


def _tags():
    global _TAGS
    if _TAGS is None:
        from defence360agent.utils import OsReleaseInfo

        _TAGS = {
            "av_version": None,
            "version": None,
            "os_details": stub_unexpected_error(OsReleaseInfo.pretty_name)(),
            "ip": None,
            "hosting_panel": None,
            "total_ram": _get_total_ram(),
            "firewall": None,
            "strategy": None,
            "virtualization": _get_virtualization_type(),
            "server_id": None,
            "name": None,
        }
    return _TAGS


def set_firewall_type(firewall: str) -> None:
    _tags()["firewall"] = firewall


def set_hosting_panel(panel: str) -> None:
    _tags()["hosting_panel"] = panel


def set_strategy(strategy: str) -> None:
    _tags()["strategy"] = strategy


def set_ip(ip: str) -> None:
    _tags()["ip"] = ip


def set_product_name(product: str) -> None:
    _tags()["name"] = product


def set_server_id(id: str) -> None:
    _tags()["server_id"] = id


def set_version(version: str) -> None:
    _tags()["version"] = version


def set_av_version(version: str) -> None:
    _tags()["av_version"] = version


def tags() -> dict:
    return _tags().copy()


def tag(name: str) -> Any:
    return _tags()[name]

Youez - 2016 - github.com/yon3zu
LinuXploit