| Server IP : 213.136.93.164 / Your IP : 216.73.217.0 Web Server : Apache System : Linux m14200.contabo.net 5.14.0-611.54.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 6 18:03:03 EDT 2026 x86_64 User : ki692510 ( 1047) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /opt/imunify360/venv/lib64/python3.11/site-packages/defence360agent/simple_rpc/ |
Upload File : |
from defence360agent.subsys.panels.base import PanelException
from defence360agent.subsys.panels.directadmin import DirectAdmin
from defence360agent.subsys.panels.hosting_panel import HostingPanel
from defence360agent.rpc_tools import ValidationError
from defence360agent.rpc_tools.lookup import RootEndpoints, bind
class HostingPanelEndpoints(RootEndpoints):
@bind("enable-plugin")
async def enable_plugin(self, plugin_name=None):
return await self.hosting_panel.enable_imunify_plugin(plugin_name)
@bind("disable-plugin")
async def disable_plugin(self, plugin_name=None):
return await self.hosting_panel.disable_imunify_plugin(plugin_name)
@bind("add-sudouser")
async def add_sudouser(self, user):
hp = self.hosting_panel
if not isinstance(hp, DirectAdmin):
raise ValidationError("Feature available only for DirectAdmin")
return await hp.add_sudouser(user)
@bind("delete-sudouser")
async def delete_sudouser(self, user):
hp = self.hosting_panel
if not isinstance(hp, DirectAdmin):
raise ValidationError("Feature available only for DirectAdmin")
return await hp.delete_sudouser(user)
@bind("list-docroots")
async def get_docroots(self):
return {"items": await self.hosting_panel.list_docroots()}
@property
def hosting_panel(self):
try:
return HostingPanel()
except PanelException as e:
raise ValidationError(str(e))