| Server IP : 198.38.94.67 / Your IP : 216.73.217.142 Web Server : LiteSpeed System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64 User : azfilmst ( 1070) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /opt/imunify360/venv/lib/python3.11/site-packages/imav/migrations/ |
Upload File : |
"""
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 <https://www.gnu.org/licenses/>.
Copyright © 2019 Cloud Linux Software Inc.
This software is also available under ImunifyAV commercial license,
see <https://www.imunify360.com/legal/eula>
One-shot upgrade migration: drop any legacy non-JSON scan queue file.
The runtime reads JSON only; migration 002 already normalized the
on-disk objects to plain dicts.
"""
import logging
from pathlib import Path
logger = logging.getLogger(__name__)
SCANS_PATH = Path("/var/imunify360/aibolit/scans.pickle")
def _looks_like_json(raw: bytes) -> bool:
head = raw.lstrip()[:1]
return head in (b"[", b"{")
def migrate(migrator, *_, fake=False, **__):
if fake or not SCANS_PATH.exists():
return
if _looks_like_json(SCANS_PATH.read_bytes()):
return
# Drop, don't pickle-load: deserializing this file is the RCE we remove.
logger.warning("Removing legacy non-JSON scans file %s", SCANS_PATH)
SCANS_PATH.unlink(missing_ok=True)
def rollback(migrator, *_, fake=False, **__):
pass