+^T~F d Z ddlmZ ddlZddlmZ ddlmZ ddlm Z ddl
mZmZ ddl
mZ dd lmZ dd
lmZ ddlmZ ddlmZmZmZ dd
lmZmZ ddlmZ erddlm Z ee!e"e f Z# e e$ Z% G d dee Z&dS )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
)annotationsN)Queue) ExitStack) getLogger)
TYPE_CHECKINGList)
inactivity)Malware)LicenseError)MessageType)MessageSink
MessageSourceexpect)recurring_checksafe_cancel_task)malware_response)MalwareMRSUploadc e Zd ZdZ ej d Zd Zd Zd Z d Z
dd Z ee
j d
Z ed d ZddZ ee
j dd ZdS )MRSUploaderzFailed to submit a filez-(?:suspicious\..+|[CS]MW-SUS-.+|SMW-HEUR-ELF)c , t | _ d S N)r
_upload_queueselfs Y/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/plugins/mrs_uploader.py__init__zMRSUploader.__init__6 s ,1GG c ~ K || _ || _ | | | _ d S r )_sink_loopcreate_taskupload_upload_task)r loopsinks r
create_sourcezMRSUploader.create_source9 s8
,,T[[]];;r c
K d S r )r r$ s r create_sinkzMRSUploader.create_sink> s r c > K t | j d {V d S r )r r# r s r shutdownzMRSUploader.shutdownA s/ t011111111111r returntuplec g }g }g }| D ]\ }}d}d}d} |d D ]_}
||
dd z }|t |
d o| j |
d z }| |
d z } `t j ||d }|r| | |r| | | r| | |||fS )NFhitsextended_suspicious
suspiciousmatcheshash)itemsgetboolSUSP_PATTERNmatchr HitInfoappend)r results maliciousr1 r0 filedatais_extended_suspicious
is_suspiciousis_malicioushithit_infos r _separate_hits_by_typez"MRSUploader._separate_hits_by_typeD s;
!--// + +JD$%*"!M LF|
6
6''2G*O*OO&% @)//I??" "
C$5 55'/d6lCCH%
+#**84444
+!!(++++
+ ****&999r c K |d }|d S t j st d d S | | \ }}}|r4| j t j |d d {V |r4| j t j |d d {V |r4| j t j |d d {V |d d }|rBd |D }| j t j |d
d {V d S d S )Nr; z"Uploading files to MRS is disabledr<