wo4hdZddlZddlZddlZddlmZejeZedZ dZ dZ Gddej Z d Zd d d Zd d d ZdS)zZ Used to fix issue with inability to unserialize stored scans. See DEF-23121 for details. N)Pathz$/var/imunify360/aibolit/scans.picklezim360.malwarelibzimav.malwarelibceZdZfdZxZS) AVUnpicklerc$ t||S#t$r`|trDt j|tt}t||cYSwxYwN) super find_classModuleNotFoundError startswithIM360_MALWARELIB importlib import_modulereplace AV_MALWARELIBgetattr)selfmodulename av_module __class__s l/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/migrations/187_fix_scan_unserialization.pyr zAVUnpickler.find_classs 77%%fd33 3"     !122 0%3NN#3]CC y$/////   s!%A&B B)__name__ __module__ __qualname__r __classcell__)rs@rrrs8         rc||jdz}|d5}tj||dddn #1swxYwY||dS)Nz.tempwb) with_nameropenpickledumpr)objpath temp_pathfs rr"r"sty7233I    CdsAAAF)fakec|stsdSttvr td5}t |}dddn #1swxYwYt|tdS#t$r,}t dt|Yd}~dSd}~wwxYwdS)Nrbz"Failed to load pickle scans %s: %s) SCANS_PATHexistsr encode read_bytesr rloadr" Exceptionlogger exception)migratorr'___r&r#excs rmigrater6'sC :$$&&  J$9$9$;$;;; "&& ,!!!nn))++ , , , , , , , , , , , , , , , j ! ! ! ! !       4j#           <;s<B;+"B B;BB; B!B;; C1!C,,C1cdSr)r2r'r3r4s rrollbackr97sDr)__doc__r loggingr!pathlibr getLoggerrr0r*r r Unpicklerrr"r6r9r8rrr?s   8 $ $ T8 9 9 %!      &"    % " " " " " !&       r