403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/glances/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/glances/__pycache__/server.cpython-310.pyc
o

�v�a�!�@s�dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
ddlmZddlmZdd	lmZGd
d�de	e�ZGdd
�d
e
e�ZGdd�de�ZGdd�de�ZdS)zManage the Glances server.�N)�	b64decode��__version__)�SimpleXMLRPCRequestHandler�SimpleXMLRPCServer�Server)�GlancesAutoDiscoverClient)�logger)�GlancesStatsServer)�TimercsLeZdZdZdZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
�ZS)�GlancesXMLRPCHandlerzMain XML-RPC handler.)z/RPC2cs|��tt|���dS�N)�send_my_headers�superr�end_headers��self��	__class__��0/usr/lib/python3/dist-packages/glances/server.pyr)sz GlancesXMLRPCHandler.end_headerscCs|�dd�dS)NzAccess-Control-Allow-Origin�*)�send_headerrrrrr/�z$GlancesXMLRPCHandler.send_my_headersc
Cs�z
|�d��d�\}}}Wnty|jjYSw|�d��d�\}}}|dks/Jd��|��}t|�}|��}|�d�\}}}	|�||	�S)N�
Authorization� �Basicz#Only basic authentication supported�:)	�get�	partition�	Exception�server�isAuth�encoder�decode�
check_user)
r�headers�basic�_�encoded�encoded_byte_string�
decoded_bytes�decoded_string�username�passwordrrr�authenticate3s�z!GlancesXMLRPCHandler.authenticatecCs6||jjvrddlm}|�}|�|jj||�SdS)Nr)�GlancesPasswordF)r!�	user_dict�glances.passwordr0�check_password)rr-r.r0�pwdrrrr%Ks
zGlancesXMLRPCHandler.check_usercCs*t�|�r|�|j�r
dS|�dd�dS)NTi�zAuthentication failedF)r�
parse_requestr/r&�
send_errorrrrrr5Ts

z"GlancesXMLRPCHandler.parse_requestcGsdSr
r)r�
log_format�argsrrr�log_message^�z GlancesXMLRPCHandler.log_message)�__name__�
__module__�__qualname__�__doc__�	rpc_pathsrrr/r%r5r9�
__classcell__rrrrr#s	
rcs:eZdZdZdZdef�fdd�	Zdd�Zdd	�Z�Z	S)
�GlancesXMLRPCServerz0Init a SimpleXMLRPCServer instance (IPv6-ready).Fi�c
s�||_||_z
t�||�dd|_Wn tjy3}zt�d�|��t�	d�WYd}~nd}~wwt
t|��||f|�dS)NrzCouldn't open socket: {}�)
�bind_address�	bind_port�socket�getaddrinfo�address_family�errorr	�format�sys�exitrrA�__init__)rrCrD�requestHandler�errrrLis��zGlancesXMLRPCServer.__init__cCs|��d|_dS)zStop the serverTN)�server_close�finishedrrrr�endvs
zGlancesXMLRPCServer.endcCs|js|��|jrdSdS)z	Main loopN)rP�handle_requestrrrr�
serve_forever{s�z!GlancesXMLRPCServer.serve_forever)
r;r<r=r>rPrrLrQrSr@rrrrrAcs�
rAc@sVeZdZdZ		ddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�GlancesInstancez?All the methods of this class are published as XML-RPC methods.NcCs.t||d�|_|j��td�|_|j|_dS)N)�configr8r)r
�stats�updater�timer�cached_time)rrUr8rrrrL�s

zGlancesInstance.__init__cCs(|j��r|j��t|j�|_dSdSr
)rXrPrVrWrrYrrrr�
__update__�s

�zGlancesInstance.__update__cCstSr
rrrrr�init�r:zGlancesInstance.initcCs|��t�|j���Sr
)rZ�json�dumpsrV�getAllrrrrr^�szGlancesInstance.getAllcC�t�|j���Sr
)r\r]rV�getPluginsListrrrr�
getAllPlugins�rzGlancesInstance.getAllPluginscCr_r
)r\r]rV�getAllLimitsAsDictrrrr�getAllLimits�rzGlancesInstance.getAllLimitscCr_r
)r\r]rV�getAllViewsAsDictrrrr�getAllViews�rzGlancesInstance.getAllViewscCsDd}|�|�rz|��t|j|�WStyt|��wt|��)z�Overwrite the getattr method in case of attribute is not found.

        The goal is to dynamically generate the API get'Stats'() methods.
        r)�
startswithrZ�getattrrVr �AttributeError)r�item�headerrrr�__getattr__�s
�zGlancesInstance.__getattr__)NN)r;r<r=r>rLrZr[r^rarcrerkrrrrrT�s
�rTc@s8eZdZdZeddfdd�Zdd�Zdd�Zd	d
�ZdS)�
GlancesServerz.This class creates and manages the TCP server.Nc
Cs�||_zt|j|j|�|_Wnty-}zt�d�|��t	�
d�WYd}~nd}~wwtd�|j|j��i|j_d|j_
|j��|j�t||��|jjsbtt���dd�d|�|_dSt�d�dS)	NzCannot start Glances server: {}�z*Glances XML-RPC server is running on {}:{}F�.rBrz)Glances autodiscover announce is disabled)r8rArC�portr!r r	�criticalrIrJrK�printr1r"� register_introspection_functions�register_instancerT�disable_autodiscoverrrE�gethostname�split�autodiscover_client�info)rrMrUr8rNrrrrL�s ��
 zGlancesServer.__init__cCs||jj|<d|j_dS)zAdd an user to the dictionary.TN)r!r1r")rr-r.rrr�add_user�szGlancesServer.add_usercCs.|jjdkr|�|jj|jj�|j��dS)zCall the main loop.�N)r8r.ryr-r!rSrrrrrS�szGlancesServer.serve_forevercCs |jjs	|j��|j��dS)z"End of the Glances server session.N)r8rtrw�closer!rQrrrrrQ�s
zGlancesServer.end)	r;r<r=r>rrLryrSrQrrrrrl�s
�!rl)r>r\rErJ�base64r�glancesr�glances.compatrrr�glances.autodiscoverr�glances.loggerr	�glances.stats_serverr
�
glances.timerr�objectrrArTrlrrrr�<module>s@C

Youez - 2016 - github.com/yon3zu
LinuXploit