Uname : Linux premium36.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Soft : LiteSpeed
Ip : 198.54.115.237
Port : 443
~
/
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
cl_website_collector
/
__pycache__
[ HOME ]
Exec
Submit
apache_processor.cpython-311.pyc
� �8i�. � �X � d dl Z d dlZd dlZd dlZd dlmZmZmZmZ G d� d� � Z dS )� N)�Dict�List�Optional�Anyc � � e Zd ZdZdej fd�Zdee fd�Z defd�Z dee fd�Zde eef fd�Zd ee dee fd �Zd ee de eef fd�Zde eef fd�Z ddede eef deddfd�ZdS )�ApacheProcessorz? Collects Apache configuration and module information. �loggerc �b � g d�| _ g d�| _ || _ d | _ d | _ d | _ d S )N)z/etc/apache2/conf/z/etc/apache2/conf-available/z/etc/apache2/conf.d/z/etc/apache2/conf.modules.d/)z$/etc/apache2/conf.d/userdata/ssl/2_4z$/etc/apache2/conf.d/userdata/std/2_4z$/etc/apache2/conf.d/userdata/ssl/2_2z$/etc/apache2/conf.d/userdata/std/2_2)�apache_config_locations�user_config_base_pathsr �_apache_binary_cache�_apache_version_cache�_apache_modules_cache)�selfr s �\/opt/cloudlinux/venv/lib64/python3.11/site-packages/cl_website_collector/apache_processor.py�__init__zApacheProcessor.__init__ sQ � �( � ( � ( ��$�' � ' � ' ��#� ���$(��!�%)��"�%)��"�"�"� �returnc �` � | j �| j S d} dD ]]}t j |� � }|rEt j |t j � � r&| j � d|� � || _ |c S �^n# t $ r}|}Y d}~nd}~ww xY w| j � d|� � d| _ dS )zQ Find Apache binary executable using which command with caching. N)�httpd�apache2zFound Apache binary: %sz"Apache binary not found in PATH %s) r �shutil�which�os�access�X_OKr �debug� Exception)r �error�binary_name�binary_path�es r �_find_apache_binaryz#ApacheProcessor._find_apache_binary+ s� � � �$�0��,�,��� �3� '� '��$�l�;�7�7��� '�2�9�[�"�'�#B�#B� '��K�%�%�&?��M�M�M�0;�D�-�&�&�&�&�� '�� � � � ��E�E�E�E�E�E����� ���� ����>��F�F�F�$(��!��ts �AA3 �1A3 �3 B �=B�B c � � | j �| j S | � � � }|sd| _ | j S t j |dgdddd�� � }|j dk rF|j � � � }|r#|� d � � d }|| _ n)d | _ n!d|j � � � � �| _ n8# t j $ r d| _ Y n t $ r}d |� �| _ Y d}~nd}~ww xY w| j S )z> Get Apache version information with caching. NzApache binary not foundz-vT� F��capture_output�text�timeout�checkr � zVersion info emptyzError getting version: zVersion check timed outzVersion check failed: )r r# � subprocess�run� returncode�stdout�strip�split�stderr�TimeoutExpiredr )r � apache_binary�result�version_output� first_liner"