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__/powerdns.cpython-36.pyc

3

�uGh=�@s�yddlmZmZWn$ek
r8ddlmZmZYnXddlZddlZddlZddlZGdd�dej�Z	e
dkr~e	�j�dS)�)�urlopen�RequestNc@seZdZdZdd�ZdS)�PluginZpowerdnsc
7Cs�tj|jtd�dd|jtd�id�}d}t�}d}t�}|j�}|jtd�r^t|jtd��}|jtd	�r�tj|||jtd	�d
�}n4|jtd�r�tj|||jtd�d�}ntj||d
�}t	j	�|d<yt
j|j��}Wnt
k
r�dSXdO}	dP}
t�}x�|D]�}dK|k�rdL|k�rdM|k�r|dMdNk�r|dK|	k�rv|j|dKt|dL�|�||dK<t|dL�||dK<n"|dK|
k�rt|dL�||dK<�qWt	j	�|d<|j|�|S)Qa�
        Experimental plugin for PowerDNS authoritative server. Might also work with PowerDNS recursor,
        but it may need extra delta_keys / absolute_keys.
        Add to /etc/agent360.ini:
        [powerdns]
        enabled=yes
        statistics_url=http://localhost:8081/api/v1/servers/localhost/statistics
        api_key=changeme
        ;ca_file=
        ;ca_path=
        ;timeout=10
        Zstatistics_urlz	X-API-Keyz%sZapi_key)�headers�
N�timeoutZca_file)r�cafileZca_path)r�capath)r�tsF�corrupt-packets�deferred-cache-inserts�deferred-cache-lookup�deferred-packetcache-inserts�deferred-packetcache-lookup�dnsupdate-answers�dnsupdate-changes�dnsupdate-queries�dnsupdate-refused�incoming-notifications�overload-drops�packetcache-hit�packetcache-miss�query-cache-hit�query-cache-miss�
rd-queries�recursing-answers�recursing-questions�recursion-unanswered�servfail-packets�
signatures�sys-msec�tcp-answers�tcp-answers-bytes�tcp-queries�tcp4-answers�tcp4-answers-bytes�tcp4-queries�tcp6-answers�tcp6-answers-bytes�tcp6-queries�timedout-packets�udp-answers�udp-answers-bytes�udp-do-queries�
udp-in-errors�udp-noport-errors�udp-queries�udp-recvbuf-errors�udp-sndbuf-errors�udp4-answers�udp4-answers-bytes�udp4-queries�udp6-answers�udp6-answers-bytes�udp6-queries�	user-msec�key-cache-size�latency�fd-usage�meta-cache-size�open-tcp-connections�packetcache-size�qsize-q�query-cache-size�real-memory-usage�security-status�signature-cache-size�uptime�name�value�typeZ
StatisticItem)/rrr
rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9)r:r;r<r=r>r?r@rArBrCrDrE)�urllib2r�get�__name__�dictZget_agent_cache�
has_option�intr�time�json�loads�read�	ExceptionZabsolute_to_per_second�floatZset_agent_cache)
�self�config�requestr�resultsZraw_responseZ
next_cacheZ
prev_cache�statsZ
delta_keysZ
absolute_keys�data�stat�r\�B/root/tmp/pip-build-gzoz1_uw/agent360/agent360/plugins/powerdns.py�runs�&
"
z
Plugin.runN)rK�
__module__�__qualname__r^r\r\r\r]rsr�__main__)�urllib.requestrr�ImportErrorrIrOZpluginsrPZ
BasePluginrrK�executer\r\r\r]�<module>sy

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