:)H d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl
mZ ddlm
Z
ddlmZ ddlmZ dd lmZmZ dd
lmZ ej e Z G d de ZdS )
u
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Copyright © 2019 Cloud Linux Software Inc.
This software is also available under ImunifyAV commercial license,
see
N)suppress)MessageType)
MessageSource)MalwareScanType)parse_report_json)
ScanResult)InotifyWatcher)create_task_and_log_exceptionsc e Zd ZdZdZ ej d Zd Zd Z d Z
d Zd Zd e
d
efdZd e
fdZd
efdZd Zd Zd ZdS )AibolitResultsScanz
Plugin to handle generated ai-bolit scan reports.
Checks the contents of the *RESULT_SCAN_DIR* for the presence ai-bolit
report files that match the *REPORT_FILE_MASK* pattern
processes and deletes them.
z$/var/imunify360/aibolit/resident/outz!^(?P[0-9a-f-]{36})\.report$c " d | _ d | _ d S N)_watcher
_init_taskselfs `/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/plugins/aibolit_result_scan.py__init__zAibolitResultsScan.__init__3 s
c d K || _ || _ t | j | j | _ d S r )_loop_sinkr _init_handling_and_setup_watcherr )r loopsinks r
create_sourcez AibolitResultsScan.create_source7 s3
8J=
r c K | j &| j | j d {V | d S r )r cancel_shutdown_watcherr s r shutdownzAibolitResultsScan.shutdown> sT ?&O""$$$/!!!!!!! r c t j | j dd t | j | j | _ | j | j t j
d S )Ni T)modeexist_ok)
coro_callback)pathmask)osmakedirsRESULT_SCAN_DIRr
r _handle_incoming_reportr watchencoder MOVED_TOr s r _setup_watcherz!AibolitResultsScan._setup_watcherD s~
D(utDDDDJd&B
%,,..W5E
r c J | j | j d S d S r )r closer s r r z$AibolitResultsScan._shutdown_watcherO s, =$M!!!!! %$r reportreturnc |d }d t | D }| d }t ||t j }| d |_ | dg |_ | d }| d }||z
}| || t | g|_ |S ) Nsummaryc g | ]
}|d S ) file_name ).0hits r
zCAibolitResultsScan._get_scan_result_from_report..U s FFFSK FFFr scan_id)r<