HEX
Server: Apache
System: Linux dinesh8189 5.15.98-grsec-sharedvalley-2.lc.el8.x86_64 #1 SMP Thu Mar 9 09:07:30 -03 2023 x86_64
User: cgmgerenciamento1 (814285)
PHP: 8.1.26
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //usr/lib/python3.6/site-packages/tracer/resources/__pycache__/applications.cpython-36.pyc
3

�|
`"�@s�ddlmZddlmZddlmZmZddlmZddl	m
Z
ddlmZddl
mZddlmZdd	lmZdd
lZdd
lZGdd�de�ZGd
d�d�ZGdd�de�Zd
S)�)�absolute_import)�minidom)�DATA_DIR�USER_CONFIG_DIRS)�PathNotFound)�ApplicationsCollection)�_)�	Processes)�System)�SystemdDbusNc@s�eZdZedd�ege�Zddddddd	�Zed
ZdZ	e
dd
��Ze
dd��Ze
dd��Z
edd��Zedd��Ze
ifdd��Ze
dd��ZdS)�ApplicationscCs|dS)Nz/applications.xml�)�xr
r
�"/usr/lib/python3.6/applications.py�<lambda>#szApplications.<lambda>ZdaemonZstaticZsession�applicationZerasedZ	undefined)�DAEMON�STATIC�SESSION�APPLICATIONZERASED�UNDEFrNcCsZtjstj�x0tjD]&}|j|krd|kr0|Stj|j�SqWt|tjddddd��S)N�renamerF)�name�type�helper�note�ignore)r�_apps�_load_definitionsr�findr�Application�TYPES)Zapp_name�appr
r
rr0s
zApplications.findcCstjstj�tjS)N)rrrr
r
r
r�allBszApplications.allcCsbt�t_xTtjD]J}ytj|�Wqtk
rX}ztjj|�t	krH|�WYdd}~XqXqWdS)N)
rrr�DEFINITIONS�_loadr�os�path�dirnamer)�fileZexr
r
rrIszApplications._load_definitionsc
Cs�y(t|d��}tj|j��}WdQRXWntk
rDtd��YnXx�|jd�D]�}|j|�x||jD]r}|j	dkr�t
|jj��}t
j|�|j	dkrh|j|�x6|jD],}t
|jj��}t
|jj��}	t
j||	�q�WqhWqRWdS)N�rr�applicationsr"�group)�openrZparseString�read�IOErrorrZgetElementsByTagName�_remove_unwanted_children�
childNodesZnodeName�dictZ
attributes�itemsr�_append_application)
�clsr)�fZxmldocr+�childZattrsr"Z	app_attrsZgroup_attrsr
r
rr%Rs"




zApplications._loadcCs*x$|jD]}|j|jkr|j|�qWdS)N)r1ZnodeTypeZELEMENT_NODEZremoveChild)r5Znoder7r
r
rr0hsz&Applications._remove_unwanted_childrencCs�t|�}|j|�|tjkr:tjj|�}tj|j|�nD|jdtj�|jdtj|��|jdd�|jdd�tjj|�dS)NrrrrF)	r �updaterr�index�
setdefault�DEFAULT_TYPE�_helper�append)Z
default_attrsZspecific_attrsr�ir
r
rr4ns

z Applications._append_applicationcCsj|jtjdkr6tj�dkr(dj|j�Sdj|j�Sn0|jtjdkrNtd�S|jtjdkrftd�SdS)	Nr�systemdzsystemctl restart {0}zservice {0} restartrz%You will have to reboot your computerrz'You will have to log out & log in again)rrr!r
�init_system�formatrr)r"r
r
rr<}szApplications._helper)�__name__�
__module__�__qualname__�maprrr$r!r;r�staticmethodrr#r�classmethodr%r0r4r<r
r
r
rr!s"	rc@s�eZdZdZeZdZdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zed'd(��Zed)d*��ZdZdS)+r a�
	Represent the application defined in ``applications.xml``

	:param str name: The name of the application
	:param str type: See ``Applications.TYPES`` for possible values
	:param str helper: Describes how to restart the applications
	:param bool note: Provides additional informations to the ``helper``
	:param bool ignore: If ``True``, the application won't be printed
	:param Processes processes_factory: Class providing list of running processes

	NcCs
||_dS)N)�_attributes)�selfZattributes_dictr
r
r�__init__�szApplication.__init__cCst|t�o|j|jkS)N)�
isinstancer r)rI�otherr
r
r�__eq__�szApplication.__eq__cCs|j|�S)N)rM)rIrLr
r
r�__ne__�szApplication.__ne__cCs
t|j�S)N)�hashr)rIr
r
r�__hash__�szApplication.__hash__cCs
|j|S)N)rH)rI�itemr
r
r�__getattr__�szApplication.__getattr__cCs
t|j�S)N)�lenrH)rIr
r
r�__len__�szApplication.__len__cCs
||jkS)N)rH)rIrQr
r
r�__contains__�szApplication.__contains__cCsd|jjd|jddS)N�<z: r�>)�	__class__rBrH)rIr
r
r�__str__�szApplication.__str__cCs|j�S)N)rY)rIr
r
r�__repr__�szApplication.__repr__cCs|jj||�dS)N)rHr:)rI�key�valuer
r
rr:�szApplication.setdefaultcCs t|t�r|j}|jj|�dS)N)rKr rHr8)rI�valuesr
r
rr8�s
zApplication.updatecCs|jo|jdjS)Nr)�	instances�is_interpreted)rIr
r
rr_�szApplication.is_interpretedcCs(tjdt|j��rdS|jo&|jdjS)Nzssh-.*-sessionTr)�re�search�strrr^�
is_session)rIr
r
rrc�szApplication.is_sessioncCsH|jdtjdks|jdS|jr.tjdS|jr>tjdStjSdS)Nrrrr)rHrr!rc�
is_servicer;)rIr
r
rr�s


zApplication.typecCs$tj�dkr t�jdj|j��SdS)Nr?z{0}.service)r
r@rZunit_path_from_idrAr)rIr
r
rrd�szApplication.is_servicecCsV|jdr|jdntj|�}tj�dkrR|jtjdkrR|rR|jd�rRd|}|S)Nr�rootrzsudo )rHrr<r
�userrr!�
startswith)rIrr
r
rr�s
zApplication.helpercCs|js
dSttjd|j��S)Nz\{.*\})r�boolr`ra)rIr
r
r�helper_contains_formating�sz%Application.helper_contains_formatingcCs|js
dSttjd|j��S)Nz\{NAME\})rrhr`ra)rIr
r
r�helper_contains_name�sz Application.helper_contains_namecCsTg}|jrP|js|j|j�n2x0|jD]&}|j|jj|j|j|j|jd��q&W|S)ab
		Return the list of helpers which describes how to restart the application.
		When no ``helper_format`` was described, empty list will be returned.
		If ``helper_format`` contains process specific arguments such a ``{PID}``, etc.
		list will contain helper for every application instance.
		In other cases, there will be just one helper in the list.
		)�NAMEZPNAMEZPID�EXE)rrir=�affected_instancesrAr�pidZexe)rI�helpers�processr
r
rro�s	
zApplication.helperscs�jj�j�fdd��S)zo
		Return collection of processes with same name as application.
		I.e. running instances of the application
		cs�jd|j�|jgkS)Nr)rHr�	real_name)rp)rIr
rrsz'Application.instances.<locals>.<lambda>)�processes_factoryr#Zfiltered)rIr
)rIrr^	s
zApplication.instances)rBrCrD�__doc__r	rrrHrJrMrNrPrRrTrUrYrZr:r8�propertyr_rcrrdrrirjror^rmr
r
r
rr �s0	r c@seZdZedd��ZdS)�AffectedApplicationcCs�tj�dkrpt�}|jrp|j|jdj�rp|j|jdjd�sp|j|jdjd�}|rptj	d|�rptj
dd|�S|jr�|jdjS|j
dS)Nr?rZPAMName�Idz
\.service$�r)r
r@rr^Zunit_path_from_pidrnZhas_service_property_from_pidZget_unit_property_from_pidr`ra�subr_rqrH)rIZbusrvr
r
rrszAffectedApplication.nameN)rBrCrDrtrr
r
r
rrusru)Z
__future__rZxml.domrZtracer.pathsrrZtracer.resources.exceptionsrZtracer.resources.collectionsrZtracer.resources.langrZtracer.resources.processesr	Ztracer.resources.systemr
Ztracer.resources.SystemdDbusrr&r`�objectrr rur
r
r
r�<module>sm