403Webshell
Server IP : 104.21.14.103  /  Your IP : 3.142.133.147
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/opt/imunify360/venv/lib64/python3.11/site-packages/defence360agent/migrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/opt/imunify360/venv/lib64/python3.11/site-packages/defence360agent/migrations//166_add_id_field_to_malware_ignore_path.py
from time import time

from peewee import CharField, Check, IntegerField, Model, PrimaryKeyField


class MalwareIgnorePath(Model):
    class Meta:
        db_table = "malware_ignore_path"
        indexes = ((("path", "resource_type"), True),)  # True refers to unique

    CACHE = None

    id = PrimaryKeyField()
    path = CharField()
    resource_type = CharField(
        null=False, constraints=[Check("resource_type in ('file','db')")]
    )
    added_date = IntegerField(null=False, default=lambda: int(time()))


def migrate(migrator, *_, fake=False, **__):
    migrator.sql(
        "ALTER TABLE malware_ignore_path RENAME TO malware_ignore_path_old;"
    )
    migrator.create_model(MalwareIgnorePath)
    migrator.sql(
        "INSERT INTO malware_ignore_path(path,added_date,resource_type) "
        "SELECT path,added_date,resource_type FROM malware_ignore_path_old"
    )
    migrator.sql("DROP TABLE malware_ignore_path_old;")


def rollback(*_, **__):
    pass

Youez - 2016 - github.com/yon3zu
LinuXploit