K6hZzdZddlZddlZddlZddlZddlmZmZddlmZddl m Z ddl m Z m Z ddlmZmZddlmZdd lmZdd lmZdd lmZdd lmZd ZdZeje Z!de"de"de#fdZ$edde%fdZ&dZ'de"de#de#fdZ(de"de"de e"fdZ)de"de#fdZ*de"de+fdZ,dZ-dS)u  This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.  If not, see . Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see N)datetime timedelta) lru_cache)Optional)get_domains_php_infoget_installed_php_versions)MalwareScanScheduleMalwareScanScheduleInterval) MalwareHit)QueueSupervisorSync) user_list)WP_CLI_WRAPPER_PATH)PHPErrorz/usr/sbin/cagefs_enter_userz/usr/sbin/cagefsctlphp_pathdocrootreturnc0tt||gS)zGet wp cli common command list)strr)rrs I/opt/imunify360/venv/lib/python3.11/site-packages/imav/wordpress/utils.py wp_wrapperr9s # $ $h 88)maxsizectjtr$tjttjst Stjtdgdd}|j dkrt S|j d}t |ddS)z)Get the list of users enabled for CageFS.z--list-enabledT)capture_outputtextr rN) ospathisfileCAGEFS_CTL_PATHaccessX_OKset subprocessrun returncodestdoutstripsplit)resultliness rget_cagefs_enabled_usersr->s 7>>/ * *")33uu ^ *+DtFAuu M   ! ! ' ' - -E uQRRy>>rc8tdS)N)r- cache_clearrr$clear_get_cagefs_enabled_users_cacher1Ps((*****rusernameargsc|tvrTtjtr0tjttjr td|g|Sddd|dtj|gS)zNBuild the necessary command to run the given cmdline args with specified user.z--no-io-and-memory-limitsuz-sz /bin/bashz-c) r-rrr CAGEFS_ENTER_PATHr"r#shlexjoin)r2r3s rbuild_command_for_userr9Ts+---- 7>>+ , ,  rw2 2  "*      4  rdomaincNtd||t}||}|r|d|kr$t d|||d}|s$t d||t }d}|D]2}|d|kr|d }n3|s$t d|||S) zrsz* ((((((((  -,,,,,,+++++.-----1'  8 $ $99s9t9999  1#"+++S.&&s&x}&&&&R#$$+*+*+*+*+*r