48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
from sqlalchemy import Column, Boolean, Integer, String, UniqueConstraint, Date, DateTime
|
|
from sqlalchemy.orm import declarative_base
|
|
from datetime import datetime, timezone
|
|
|
|
|
|
# Crear la base declarativa
|
|
Base = declarative_base()
|
|
|
|
# Se define modelo de eventos modificados al procesar
|
|
class ModificadosEv(Base):
|
|
__tablename__ = "modificados_ev"
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
evento_uuid = Column(String, nullable=False)
|
|
publicado_fecha = Column(DateTime, nullable=False)
|
|
attribute_count = Column(Integer, nullable=False)
|
|
__table_args__ = (
|
|
UniqueConstraint('evento_uuid', 'attribute_count', name='ev_attr'),
|
|
)
|
|
|
|
|
|
def to_dict(self):
|
|
return {
|
|
"id": self.id,
|
|
"evento_uuid": self.evento_uuid,
|
|
"publicado_fecha": self.publicado_fecha,
|
|
"attribute_count": self.attribute_count
|
|
|
|
}
|
|
|
|
|
|
class VerificacionFalsoPositivo(Base):
|
|
__tablename__ = "verificacion_fp"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
ioc_value = Column(String, index=True)
|
|
ioc_type = Column(String)
|
|
fecha_verificacion = Column(DateTime)
|
|
es_falso_positivo = Column(Boolean)
|
|
|
|
def to_dict(self):
|
|
return {
|
|
"id": self.id,
|
|
"ioc_value": self.ioc_value,
|
|
"ioc_type": self.ioc_type,
|
|
"fecha_verificacion": self.fecha_verificacion,
|
|
"es_falso_positivo": self.es_falso_positivo
|
|
|
|
}
|