File size: 1,293 Bytes
2f3c093 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | import logging
import peewee
from typing import Dict, Any
from playhouse.shortcuts import model_to_dict
db = peewee.SqliteDatabase('adware.db') # Replace with your database configuration
class BaseModel(peewee.Model):
class Meta:
database = db
class Payload(BaseModel):
name = peewee.CharField()
description = peewee.TextField()
file_path = peewee.CharField()
def to_dict(self):
return model_to_dict(self)
class DeploymentMethod(BaseModel):
name = peewee.CharField()
description = peewee.TextField()
config_schema = peewee.TextField() # Store as JSON string
def to_dict(self):
return model_to_dict(self)
class Adware(BaseModel):
name = peewee.CharField()
description = peewee.TextField()
target_os = peewee.CharField()
persistence_method = peewee.CharField()
payload = peewee.ForeignKeyField(Payload, backref='adwares')
deployment_method = peewee.ForeignKeyField(DeploymentMethod, backref='adwares')
config = peewee.TextField() # Store as JSON string
def to_dict(self):
return model_to_dict(self)
def create_tables():
with db:
db.create_tables([Payload, DeploymentMethod, Adware])
if __name__ == '__main__':
create_tables() |