File manager - Edit - /opt/imunify360/venv/lib/python3.11/site-packages/clcommon/public_hooks/lib/__pycache__/helpers.cpython-311.pyc
Back
� ��]jY � �� � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlm Z d dl mZ d dlm Z ej e� � Zd� ZdZ ej d� � Zd� Zed � � � Zd � ZdS )� N)�StringIO)�contextmanager)�wrapsc �p � t | � � � dd� � � dd� � S )z5Strip control characters from a value before logging.� z\n� z\r)�str�replace��values ��/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/clcommon/public_hooks/lib/helpers.py�_sanitize_log_valuer s. � ��u�:�:���d�E�*�*�2�2�4��?�?�?� z&/usr/share/cloudlinux/hooks/listeners/z^[a-z_][a-z0-9._-]{0,31}$c � � t | t � � rt � | � � s$t j d| �dt j � �� � �| S )z�argparse type-callback that validates a hosting account name. Used by post_modify_user.py / pre_modify_user.py to reject names with shell metacharacters, path separators, or trailing newlines before dispatching to listener plugins. z invalid name z : must match )� isinstancer �_VALID_NAME_RE� fullmatch�argparse�ArgumentTypeError�patternr s r � valid_namer % s` � � �e�S�!�!� L��)A�)A�%�)H�)H� L��(�J�E�J�J�.�2H�J�J�L� L� L��Lr c # � K � t j }t j } | p t � � t _ |p t � � t _ d V � |t _ |t _ d S # |t _ |t _ w xY w)N)�sys�stdout�stderrr )�stdo�stder r s r �capture_outputr 2 sq � � � � �Z�F� �Z�F���'�X�Z�Z�� ��'�X�Z�Z�� � ������ ��� � � �� �� ��� ����s �8A. �.Bc �J � � t � � � � fd�� � }d|_ |S )a, Magic decorator that calls all subclass methods that override base decorated one. Requirements: - subclass must be defined in .py file in LISTENERS_DIRECTORY - subclass must NOT start with '_' char - subclass must override base event method (the one with '@hook_method') c �b �� | j � � � D �]�}t j � t j |� � j � � }t j � t � � t j � |� � k r#t � d|t |� � ��|j � d� � r��t |� � �j � � }t |dd� � r(t � d�j |j � � ��t � d�j |j � � t# j � � }t% � � t% � � }} t'