WHHA d Z ddlZddlZddlZddlZddlmZ ej e Z ed Z
dZdZ G d dej
Zd Zd
ddZd
dd
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.malwarelibc e Zd Z fdZ xZS )AVUnpicklerc 2 t || S # t t f$ r` | t
rDt
j | t
t }t || cY S w xY wN)super
find_classImportErrorModuleNotFoundError
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%%fd33301 00
0%3NN>>BB y$/////
s !% A-BB)__name__
__module____qualname__r
__classcell__)r s @r r r ' s8 r c | |j dz }| d 5 }t j | | d d d n# 1 swxY w Y | | d S )Nz.tempwb) with_namer openpickledumpr )objpath temp_pathfs r r# r# 4 s ty7233I C ds AAAF)fakec ( |st sd S t t v r t d 5 }t
| }d d d n# 1 swxY w Y t j d |D }t |t d S # t $ r,}t
dt | Y d }~d S d }~ww xY wd S )Nrbc
3 K | ]A}|j |j |j |j |j |j |j j |j j d V BdS ))r% scanid scan_typecreatedstartedargs
resource_typestateN) r% r, r- r. r/ r0 r1 valuer2 ).0items r zmigrate..F sn ( ( !I"k!%#|#| I%)%7%=!Z- ( ( ( ( ( (r z"Failed to load pickle scans %s: %s)
SCANS_PATHexistsr
encode
read_bytesr! r loadcollectionsdequer# Exceptionlogger exception)migratorr( ___r' scansupdatedexcs r migraterG = su :$$&&