[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: incidents.py
File is not writable. Editing disabled.
from defence360agent.model.simplification import remove_old_and_truncate from defence360agent.rpc_tools import ValidationError, lookup from defence360agent.rpc_tools.utils import run_in_executor_decorator from defence360agent.utils import Scope from im360.contracts import config from im360.model.firewall import Purpose from im360.model.incident import Incident class IncidentsEndpoints(lookup.RootEndpoints): SCOPE = Scope.IM360 @lookup.bind('get') @run_in_executor_decorator def get_incident_list(self, *args, **kwargs): if ('since' not in kwargs) and ('period' not in kwargs): raise ValidationError("Either since or period should be specified") period = kwargs.pop('period', None) if period is not None: kwargs['since'] = period.since kwargs['to'] = period.to severity = kwargs.pop('severity', None) if kwargs.get('by_purpose'): # backward compatibility kwargs['by_list'] = [Purpose.listname(item) for item in kwargs.pop('by_purpose')] return Incident.get_sorted_incident_list( *args, severity=severity or config.IncidentLogging.MIN_LOG_LEVEL, **kwargs) @lookup.bind('clean') @run_in_executor_decorator def clean_incidents(self, days=None, limit=None): return remove_old_and_truncate( Incident, days or config.IncidentLogging.NUM_DAYS, limit or config.IncidentLogging.LIMIT )
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