$93 GRAYBYTE WORDPRESS FILE MANAGER $95

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/api/server/

HOME
Current File : /opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/api/server//events.py
import urllib.request
import logging
import datetime

from defence360agent.api.server import API
from defence360agent.internals.iaid import IndependentAgentIDAPI
from defence360agent.rpc_tools.utils import run_in_executor_decorator

logger = logging.getLogger(__name__)


class EventsAPI(API):
    ADVICES_API_URL_TEMPLATE = (
        "{base}/api/dashboard/events?dashboard=false&"
        "popup=true&not_snoozed_at={not_snoozed_at}"
    )
    NOTIFICATIONS_API_URL_TEMPLATE = (
        "{base}/api/dashboard/v2/events?notification=1&enduser=true"
    )
    SMART_ADVICE_API_URL_TEMPLATE = (
        "{base}/api/dashboard/v2/events?smartadvice=true"
    )

    @classmethod
    @run_in_executor_decorator
    def advices(cls):
        request = urllib.request.Request(
            cls.ADVICES_API_URL_TEMPLATE.format(
                base=cls._BASE_URL,
                not_snoozed_at=int(datetime.datetime.now().timestamp()),
            ),
            method="GET",
        )
        result = cls.request(request)
        return result["result"]

    @classmethod
    async def notification(cls):
        request = urllib.request.Request(
            cls.NOTIFICATIONS_API_URL_TEMPLATE.format(base=cls._BASE_URL),
            method="GET",
            headers={"X-Auth": await IndependentAgentIDAPI.get_token()},
        )
        return await cls._send_notifications(request)

    @classmethod
    async def smart_advices(cls):
        request = urllib.request.Request(
            cls.SMART_ADVICE_API_URL_TEMPLATE.format(base=cls._BASE_URL),
            method="GET",
            headers={"X-Auth": await IndependentAgentIDAPI.get_token()},
        )
        return cls.request(request)["result"]

    @classmethod
    @run_in_executor_decorator
    def _send_notifications(cls, request):
        result = cls.request(request)
        return result["result"]


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2026 8.45 AM
root / root
0755
__pycache__
--
3 Mar 2026 8.45 AM
root / root
0755
__init__.py
2.787 KB
23 Jan 2026 1.13 PM
root / root
0644
analyst_cleanup.py
5.244 KB
23 Jan 2026 1.13 PM
root / root
0644
cleanup_revert.py
0.798 KB
23 Jan 2026 1.13 PM
root / root
0644
events.py
1.821 KB
23 Jan 2026 1.13 PM
root / root
0644
reputation.py
2.235 KB
23 Jan 2026 1.13 PM
root / root
0644
send_message.py
5.311 KB
23 Jan 2026 1.13 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF