Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.6/site-packages/agent360/plugins/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.6/site-packages/agent360/plugins/__pycache__/minecraft.cpython-36.pyc

3

�uGhj	�@sHddlZddlZddlZddlZGdd�dej�ZedkrDe�j�dS)�Nc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�Plugin�	minecraftcCsr|jdd�jd�}i}�xT|D�]J}y�tjtjtj�}|jd�d}t|jd�d�}|j||f�|j|jd|j|j	d��|j
|�d	��|j|jd
��|j|�|j|�|j|�}d}	xt|	�|kr�|	|j
d�7}	q�W|j�WnYnXi}
y8tj|	jd��d
}t|d�|
d<t|d�|
d<Wnd|
d<d|
d<YnX|
|t|jdd��<qW|S)z�
        Fetch the amount of active and max players
        add to /etc/agent360.ini
        [minecraft]
        enabled=yes
        hosts=127.0.0.1:8000,127.0.0.2:8000...
        r�hosts�,�:r�z�utf8���i�playersZonline�max�.�-)�get�split�socket�AF_INET�SOCK_STREAM�int�connect�send�	pack_data�encode�	pack_port�
unpack_varint�len�recv�close�json�loads�decode�str�replace)�self�configZmy_hosts�resultZconnection_string�s�hostname�port�l�d�resultsr�r-�C/root/tmp/pip-build-gzoz1_uw/agent360/agent360/plugins/minecraft.py�run	s:	.


z
Plugin.runcCsFd}x<td�D]0}t|jd��}||d@d|>O}|d@sPqW|S)Nr�r���)�range�ordr)r$r'r+�i�br-r-r.r<szPlugin.unpack_varintcCsHd}x>|d@}|dL}|tjd||dkr,dndB�7}|dkrPqW|S)Nrr1r2�Brr3)�struct�pack)r$r+�or7r-r-r.�pack_varintEs zPlugin.pack_varintcCs|jt|��|S)N)r<r)r$r+r-r-r.rOszPlugin.pack_datacCstjd|�S)Nz>H)r9r:)r$r6r-r-r.rRszPlugin.pack_portN)�__name__�
__module__�__qualname__r/rr<rrr-r-r-r.rs3	
r�__main__)Zpluginsrr9rZ
BasePluginrr=�executer-r-r-r.�<module>sO

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