Sindbad~EG File Manager

Current Path : /usr/lib/python3.6/site-packages/tracer/controllers/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/tracer/controllers/__pycache__/default.cpython-36.opt-1.pyc

3

"e��@s�ddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZdd	lmZdd
lmZddlmZddlmZyeZWnek
r�YnXGd
d�de�ZdS)�N)�
HooksObserver)�DefaultView)�InteractiveView)�NoteForHiddenView)�_)�Tracer)�System)�dump_memory)�Applications)�Rules)�HelperControllerc@sXeZdZdZdZdZdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dS)�DefaultControllerNcCs�||_ttj|jd�tttt�|jd�|_	|j
|j	_
|jd|j	_|rN||j	_|j	j
|j|j��|_|jjr�|jjtjdg�|_dS)N)�erased)ZmemoryZhooks_observerrr�DAEMON)�argsrrZpackage_managerrrr
r	r�tracerZnowZ	timestampZspecified_packagesZtrace_affected�_user�user�applicationsZdaemons_onlyZfilter_types�TYPES)�selfrZpackages�r�/usr/lib/python3.6/default.py�__init__/s
zDefaultController.__init__cCsJ|jjs:t�}|jd|j�|jd|j�|j�|j�t|j��dS)Nrr)	rZ
hooks_onlyr�assignr�render�create_reboot_required_file�exit�status_code)r�viewrrrrBszDefaultController.rendercCs�t|j�}x.|j|j|j�D]}|j||j�td�qWt�}|jd|j�|jdt|j��|jd|jj	t
jd��|jd|jj	t
jd��|j�dS)N�r�total_count�
session_count�SESSION�static_count�STATIC)
rr�_restartable_applicationsr�print_helper�printrr�len�
count_typer
rr)r�helper_controllerZapplicationrrrr�render_helpersKs
z DefaultController.render_helpersc
Csdt|j�}|j|j|j�jd�}�x<t�}|jd|�|jd|j�|jdt|j��|jd|jjt	j
d��|jd|jjt	j
d��|j�|jd�|jd�|jd�kr�Pt
d	td
��td�}yJ|dkr�dSt|�d
ks�t|�t|�kr�t�|j|t|�d|j�Wn(tttfk
�r<t
td��YnXtjjdtd�d�t�q$WdS)N�namerrr!r"r#r$r%�
z0Press application number for help or 'q' to quitz--> �qr�zWrong application numberz
-- z)Press <enter> to get list of applicationsz --)rrr&r�sortedrrr)r*r
rr�getr(r�input�int�
IndexErrorr'�SyntaxError�
ValueError�sys�stdout�write)rr+ZfilteredrZanswerrrr�render_interactiveXs0
z$DefaultController.render_interactivecCs\d}t|j�dkrd}|jjtjd�r,d}|jjtjd�rBd}|jjtjd�rXd}|S)	z�
		0   - No affected applications
		101 - Found some affected applications
		102 - Found some affected daemons
		103 - Session restart needed
		104 - Reboot needed
		r�er�fr#�gr%�h)r)rr*r
r)r�coderrrrvszDefaultController.status_codec	Cs6|jjtjd�r2tdd��}|jd�WdQRXdS)zm
		If a reboot is needed, create a /run/reboot-required file.
		This is how Debian/Ubuntu distros does it.
		r%z/run/reboot-required�wzTracer says reboot is required
N)rr*r
r�openr:)r�fprrrr�sz-DefaultController.create_reboot_required_filecCs$|js |jtjdtjdg�S|S)Nr%r#)�allZ
exclude_typesr
r)rrrrrrr&�sz+DefaultController._restartable_applicationscCs:|dgks|dkrdS|dkr"|S|s.tj�S|dSdS)N�*�rootr)rr)rrrrrr�szDefaultController._user)�__name__�
__module__�__qualname__rrZ	processesrrr,r;rrr&rrrrrr
)s	
	r
)�osr8Ztracer.hooksrZtracer.views.defaultrZtracer.views.interactiverZtracer.views.note_for_hiddenrZtracer.resources.langrZtracer.resources.tracerrZtracer.resources.systemrZtracer.resources.memoryr	Ztracer.resources.applicationsr
Ztracer.resources.rulesrZtracer.controllers.helperrZ	raw_inputr3�	NameError�objectr
rrrr�<module>s"

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists