#edit defs
This commit is contained in:
parent
9e9626a856
commit
d158cc260b
2 changed files with 4 additions and 3 deletions
|
@ -8,8 +8,9 @@ class ModificadosEv(Base):
|
|||
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', 'publicado_fecha', name='ev_pub_fecha'),
|
||||
UniqueConstraint('evento_uuid', 'attribute_count', name='ev_attr'),
|
||||
)
|
||||
|
||||
def get_engine(db_path: str):
|
||||
|
|
4
defs.py
4
defs.py
|
@ -25,7 +25,7 @@ class MISPProcessor:
|
|||
# Para publicar
|
||||
publica = False
|
||||
|
||||
stmt = select(ModificadosEv).where(ModificadosEv.evento_uuid == event_uuid)
|
||||
stmt = select(ModificadosEv).where(ModificadosEv.evento_uuid == event_uuid, ModificadosEv.attribute_count == int(event_attribute_count))
|
||||
existe = session.scalars(stmt).first()
|
||||
|
||||
if existe:
|
||||
|
@ -72,7 +72,7 @@ class MISPProcessor:
|
|||
if a["disable_correlation"]:
|
||||
self.misp.direct_call(f"attributes/edit/{a['id']}", {"disable_correlation": False})
|
||||
publica = True
|
||||
new_ev = ModificadosEv(evento_uuid=event_uuid, publicado_fecha=datetime.now(timezone.utc))
|
||||
new_ev = ModificadosEv(evento_uuid=event_uuid, publicado_fecha=datetime.now(), attribute_count=int(event_attribute_count))
|
||||
session.add(new_ev)
|
||||
try:
|
||||
session.commit()
|
||||
|
|
Loading…
Add table
Reference in a new issue