oK:! d Z ddlZddlZddlmZ ddlmZ ddlmZm Z ddl
mZ ddlm
Z
ddlmZ ej e Zd Z G d
de ZdS )zBulk WAF set endpoint. N) Wordpress)ValidationError)
RootEndpointsbind)
hosting_panel)Scope)
update_config
c
r e Zd Zej Z eddd ddedede e dz d e
fd
ZdS )WordpressWafBulkEndpointszwordpress-pluginwafsetFNstatus all_usersusersreturnc X K |r|t d |s|t d ||st d t j st d t d||| t t
j d {V }n%# t $ r}t d| |d }~ww xY wg }g }g }|rt | } nQg } t | D ]4}
|
|v r|
|
|
|
dd 5|d k d
t dt t t d z f f fdt! d
t# | t$ D ]l}fd| ||t$ z D }t' j | d {V }
|
D ]5\ }
}||
|
|
|
|d 6mg d |D d |D d |D }||||dS )Nz/Specify either --all-users or --users, not bothz%Specify either --all-users or --usersz--users must not be emptyzNWordPress Security Plugin is disabled. Enable it before changing WAF settings.z>AUDIT wordpress-plugin.waf.set status=%r all_users=%r users=%rz#Could not enumerate hosting users: zNot a hosting user)userreasonenabledur c K t j ddii| d {V | d fS # t $ r}| t | fcY d }~S d }~ww xY w)N WORDPRESSwaf_enabled)r )r _sink Exceptionstr)r eself waf_values [/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/simple_rpc/wp_waf_bulk.py_apply_to_userz9WordpressWafBulkEndpoints.waf_set.