{ d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl m Z d dlmZ d dlm Z mZmZmZmZ d dlZd dlmZ d dlmZ d dlmZ d dlmZmZmZ d d lmZ d Z ed Z ej! e" Z#dZ$ ed de%fd Z&d Z' G d de( Z) G d de( Z* G d de) Z+ddZ, G d d Z- G d d Z.d Z/dS ) N)defaultdict)Path) parse_qsl urlencodeurljoinurlparse urlunparse)ANTIVIRUS_MODE) LicenseCLN)HostingPanel) CheckRunErrorasync_lru_cache check_run)get_hostnamei, z/usr/sbin/ie-configzpwget -qq -O - https://repo.imunify360.cloudlinux.com/defence360/imunifyemail-deploy.sh | bash -s 'is-supported' )maxsizereturnc K t t d d {V nM# t $ r@} | j dk r*t dt | Y d } ~ dS d } ~ ww xY wdS )NT)shelld zimunify-email check failed F)r IE_SUPPORTED_CMDr returncodeloggererrorstr)es R/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/internals/cln.pyis_imunify_email_supportedr s (55555555555 <3LL?s1vv??@@@uuuuu 4s ! A+5A&&A+c K t rdS t sdS t t t dg d{V } n# t $ r Y dS w xY wd| v S )zTry to get imunify-email statusFstatusNz&spamfilter exim configuration: enabled)r _IMUNIFY_EMAIL_CONFIG_EXECUTABLEexistsr r r decode)outputs r get_imunify_email_statusr% * s u+2244 u 1 2 2H= uu3v}}FFs )A A A c e Zd ZddZd ZdS )CLNErrorNc " || _ || _ d S Nmessager )selfr r+ s r __init__zCLNError.__init__: s c R | j r| j S d | j S )Nz#Unexpected status code from CLN: {})r+ formatr r, s r __str__zCLNError.__str__> s* <