[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: myimunify.py
File is not writable. Editing disabled.
import urllib.parse from typing import List, Optional import defence360agent.subsys.panels.hosting_panel as hp from defence360agent.contracts import sentry from defence360agent.contracts.config import MyImunifyConfig from defence360agent.myimunify.model import ( MyImunify, set_protection_status_for_all_users, update_users_protection, ) from defence360agent.rpc_tools import lookup from defence360agent.rpc_tools.utils import run_in_executor_decorator from defence360agent.utils import Scope class MyImunifyEndpoints(lookup.RootEndpoints): SCOPE = Scope.IM360 @lookup.bind("myimunify", "update") async def update(self, items: List[str], protection: str): await update_users_protection( self._sink, items, protection == "enabled" ) return {} @lookup.bind("myimunify", "enable-all") async def enable_all(self): await set_protection_status_for_all_users(self._sink, True) @lookup.bind("myimunify", "disable-all") async def disable_all(self): await set_protection_status_for_all_users(self._sink, False) class MyImunifyCommonEndpoints(lookup.CommonEndpoints): SCOPE = Scope.IM360 @lookup.bind("myimunify", "status") async def status(self, items: List[str], user: Optional[str] = None): purchase_url = MyImunifyConfig.PURCHASE_PAGE_URL if user is not None: items = [user] # if MY_IMNUNIFY is disabled, we don't need to generate purchase # url with domain and ip [because it will not been shown to user] if MyImunifyConfig.ENABLED: user_domains = ( await hp.HostingPanel().get_domains_per_user() ).get(user, []) domain = next(iter(user_domains), None) purchase_url = ( MyImunifyConfig.PURCHASE_PAGE_URL + "/?" + urllib.parse.urlencode( { "m": "cloudlinux_advantage", "action": "provisioning", "suite": "my_imunify_account_protection", "username": user, "domain": domain, "server_ip": sentry.tag("ip"), } ) ) response = MyImunify.select().where(MyImunify.user.in_(items)).dicts() return { "myimunify_enabled": MyImunifyConfig.ENABLED, "purchase_page_url": purchase_url, "items": [ {"username": item["user"], "protection": item["protection"]} for item in response ], }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 691.07 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: N/A