gs dZddlZddlmZddlmZddlmZmZddl m Z ddl m Z ddl mZejeZd ed ed efd Zd ededededef dZGddeZdS)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 NPath) HookEvent) MessageSinkexpect)MalwareScanType) panel_users)notifierevent_iduserbodycK tj|||d{VdS#t$r'}td||Yd}~dSd}~wwxYw)Nz#Failed to trigger an event '%s': %r)r trigger_event Exceptionloggererror)r r r es M/opt/imunify360/venv/lib/python3.11/site-packages/imav/plugins/event_hooks.pyrr"sI$XtT::::::::::: III :HaHHHHHHHHHIs" AAApathscan_id scan_typecustom_event_id user_event_idcK|tjkrd}|}nM|tjtjfvr1t fdt d{VDd}|}ndSt |||d|d{VdS)Nc3tK|]2}tt|dk(|dV3dS)homer Nr).0urs r z%trigger_scan_event..6sN  ::ai00& 0000  )rr)r ON_DEMAND BACKGROUNDUSERnextr r)rrrrrkwargsr r s` rtrigger_scan_eventr')sO---" 1?3GH H H    *}},,,,,,       !  T44V4  r!ceZdZdZeejdZeejdZ eej dZ dS) EventHookscK||_dS)N)_loop)selfloops r create_sinkzEventHooks.create_sinkIs r!cK|d}|tjkr tj}n)|tjtjfvr tj}ndSd|dD}|D]!}t||d|did{V"dS)Nrch|] }|d S)username)rhits r z+EventHooks.malware_found..Ws:::SZ:::r!DUMPr)rr"r "CUSTOM_SCAN_MALWARE_FOUND_EVENT_IDr#r$ USER_SCAN_MALWARE_FOUND_EVENT_IDr)r,eventrr usersr s r malware_foundzEventHooks.malware_foundLs+& 1 1 1BHH ?57KL L L@HH F::E&M::: O OD$E)rVsD*;;;;;;AAAAAAAA222222777777++++++  8 $ $I#ISIIIII     >& & & & & & & & & & r!