hqdZddlZddlmZddlmZmZddlmZddl m Z m Z m Z ddl mZddlmZdd lmZdd lmZdd lmZdd lmZmZdd lmZer ddlmZddlmZeeZGdde e 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 N) getLogger) TYPE_CHECKINGAny) MessageType) MessageSink MessageSourceexpect)Scope)get_imunify_patch_id)VulnerabilityPatchTask)ImunifyPatchSubscriptionAPI)VulnerabilityHitStatus)ImunifyPatchSubscriptionVulnerabilityHit) user_list)ImunifyPatchUserId)RefreshImunifyPatchSubscriptionceZdZejZdZdZddZde de ffdZ e e j dd Zd eddfd Zd eeddfdZdS)ImunifyPatchSubscriptionPluginc KdSN)selfloops g/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/plugins/imunify_patch_subscription.py create_sinkz*ImunifyPatchSubscriptionPlugin.create_sink6s  cK||_dSr)_sink)rrsinks r create_sourcez,ImunifyPatchSubscriptionPlugin.create_source9s rreturnNc6tj|_dSr)asyncioLock_lock)rs r__init__z'ImunifyPatchSubscriptionPlugin.__init__<s\^^ rrcKi}tjd{VD]*}t|dd{V}|r |d||<+|S)Nuser)r panel_usersr )r users_mapr)patch_ids r_get_users_mapz-ImunifyPatchSubscriptionPlugin._get_users_map?su #/11111111 3 3D1$v,????????H 3&*6l (#r_rc@K|j4d{V|d{Vs.td dddd{VdSt jt d{V dddd{VdSD]'}|vr!||d{V(fdD}| |dddd{VdS#1d{VswxYwYdS)Nz,No users found while refreshing subscriptionc(g|]}|v|Srr).0user_idsubscribed_users_idsuserss r zGImunifyPatchSubscriptionPlugin.refresh_subscription..]s3""""666g666r) r&r-loggerwarningr get_subscriptionslistkeys_set_subscription_unset_subscription)rr.r2unsubscribed_usersr3r4s @@rrefresh_subscriptionz3ImunifyPatchSubscriptionPlugin.refresh_subscriptionGs~: 9 9 9 9 9 9 9 9--////////E MNNN  9 9 9 9 9 9 9 9 9 9 9 9 9 92C&& ! $+ 9 9 9 9 9 9 9 9 9 9 9 9 9 90 A Ae##00w@@@@@@@@@"""""$"""   $ $%7 8 8 8/ 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9s8D .gs*       r)filelistr)) r get_or_createrselectrAwherer)statusr VULNERABLErprocess_messager )rr)r.createdpathss rr;z0ImunifyPatchSubscriptionPlugin._set_subscriptionds-;DIII 7    )0$.%$)T1$+-89   E j00*EEEE    rr4ctjtj|dSr)rdeleterFr2in_execute)rr4s rr<z2ImunifyPatchSubscriptionPlugin._unset_subscriptionvsA '))// $ , 0 0 7 7  ')))))r)r"N)r.rr"N)__name__ __module__ __qualname__r AVSCOPErr!r'dictrr-r rrr>strr;r9r<rrrrr3s HE   $$$$d+?+D&E VK 788929 9999898CD$ctrr)!__doc__r$loggingrtypingrr"defence360agent.contracts.messagesr!defence360agent.contracts.pluginsrrr defence360agent.utilsr imav.contracts.imunify_patch_idr imav.contracts.messagesr .imav.malwarelib.api.imunify_patch_subscriptionr imav.malwarelib.configrimav.malwarelib.modelrrimav.malwarelib.utilsrrrrPr6rrrrrcs*%%%%%%%%:::::: (''''';::::::99999LLLLLLLL++++++HBBBBBBGGGGGG 8  FFFFF[-FFFFFr