File: //usr/local/lib/python3.9/site-packages/agent360/plugins/__pycache__/bitninja.cpython-39.pyc
a
q�dg � @ sD d dl Z d dlZd dlZdZG dd� de j�Zedkr@e� �� dS )� Nz&/usr/sbin/bitninjacli --stats --minifyc @ s e Zd ZdZ dd� ZdS )�PluginZbitninjac C sp z|� td�}W n t}Y n0 t�d| �}|�� }|d }|�d�}|dkrlt�||d� � dd��S dS )aj
Collects metrics from the BitNinja Linux Agent.
For this plugin to work, at least BitNinja version 2.38.8 is required, and
the following configurations must be applied to it:
/etc/bitninja/System/config.ini:
```ini
[statistics]
enableIntegration = 1
```
This will allow agent360 to access the statistics.
Then after a BitNinja restart, the plugin can be tested by running:
sudo -u agent360 agent360 test bitninja
Add to /etc/agent360.ini:
```ini
[bitninja]
enabled = true
```
ZstatCommandzsudo r �{N�
� )
�get�__name__�DEFAULT_STAT_COMMAND�os�popen� readlines�find�json�loads�replace)�self�config�command�stream�resultZ firstLineZ
startIndex� r �C/usr/local/lib/python3.9/site-packages/agent360/plugins/bitninja.py�run s
z
Plugin.runN)r �
__module__�__qualname__r r r r r r s r �__main__)Zpluginsr r
r Z
BasePluginr r �executer r r r �<module> s )