gk dZddlZddlZddlZddlZddlmZejeZ edZ dZ dZ Gddej Zd Zd d d Zd d d ZdS)ue 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 Used to fix issue with inability to unserialize stored scans. See DEF-23158 for details. N)Pathz$/var/imunify360/aibolit/scans.picklezdefence360agent.malwarelibzimav.malwarelibceZdZfdZxZS) AVUnpicklerc2 t||S#ttf$r`|t rDt j|t t}t||cYSwxYwN) super find_class ImportErrorModuleNotFoundError startswithOLD_MALWARELIB importlib import_modulereplaceNEW_MALWARELIBgetattr)selfmodulename av_module __class__s a/opt/imunify360/venv/lib/python3.11/site-packages/imav/migrations/001_fix_scan_unserialization.pyr zAVUnpickler.find_class(s 77%%fd33 301     00 0%3NN>>BB y$/////   s!%A-BB)__name__ __module__ __qualname__r __classcell__)rs@rrr's8         rc||jdz}|d5}tj||dddn #1swxYwY||dS)Nz.tempwb) with_nameropenpickledumpr)objpath temp_pathfs rr#r#4sty7233I    CdsAAAF)fakec(|stsdSttvr td5}t |}dddn #1swxYwYtj d|D}t|tdS#t$r,}t dt|Yd}~dSd}~wwxYwdS)Nrbc 3K|]A}|j|j|j|j|j|j|jj|jjdVBdS))r%scanid scan_typecreatedstartedargs resource_typestateN) r%r,r-r.r/r0r1valuer2).0items r zmigrate..Fsn ( (!I"k!%#|#| I%)%7%=!Z-   ( ( ( ( ( (rz"Failed to load pickle scans %s: %s) SCANS_PATHexistsr encode read_bytesr!rload collectionsdequer# Exceptionlogger exception)migratorr(___r'scansupdatedexcs rmigraterG=su :$$&&*"7"7"9"999 &&& .!#A++-- . . . . . . . . . . . . . . ."' ( (" ( ( (  G$ * % % % % %       4j#          %:9s<C+"B CBC B!!C D#!D  DcdSr)rAr(rBrCs rrollbackrJ[sDr)__doc__r<rloggingr"pathlibr getLoggerrr?r7r r Unpicklerrr#rGrJrIrrrPs2   8 $ $ T8 9 9 -"     &"    %&&&&&<!&       r