dia-gov's picture
Upload 102 files
2f3c093 verified
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()