mirror of
https://github.com/FunnyWolf/agentic-soc-platform.git
synced 2026-08-22 13:12:56 +02:00
arch and todo
This commit is contained in:
@@ -4,8 +4,6 @@ from pathlib import Path
|
||||
from Lib.configs import BASE_DIR
|
||||
from Lib.log import logger
|
||||
from Lib.xcache import Xcache
|
||||
from PLUGINS.SIRP.sirpapi import Playbook, Case, Alert, Artifact
|
||||
from PLUGINS.SIRP.sirpmodel import PlaybookModel, PlaybookJobStatus
|
||||
|
||||
|
||||
class PlaybookLoader:
|
||||
@@ -75,28 +73,3 @@ class PlaybookLoader:
|
||||
def list_playbook_config(cls):
|
||||
all_modules_config = Xcache.list_module_configs()
|
||||
return all_modules_config
|
||||
|
||||
@classmethod
|
||||
def run_playbook_job(cls, type, name, user_input=None, source_rowid=None, id=None):
|
||||
if source_rowid is None:
|
||||
if id is None:
|
||||
raise Exception("id is required when source_rowid is None")
|
||||
else:
|
||||
if type == "CASE":
|
||||
record = Case.get_by_id(id)
|
||||
source_rowid = record.rowid
|
||||
elif type == "ALERT":
|
||||
record = Alert.get_by_id(id)
|
||||
source_rowid = record.rowid
|
||||
elif type == "ARTIFACT":
|
||||
record = Artifact.get_by_id(id)
|
||||
source_rowid = record.rowid
|
||||
|
||||
model = PlaybookModel()
|
||||
model.source_rowid = source_rowid
|
||||
model.job_status = PlaybookJobStatus.PENDING
|
||||
model.type = type
|
||||
model.name = name
|
||||
model.user_input = user_input
|
||||
rowid = Playbook.create(model)
|
||||
return rowid
|
||||
|
||||
+26
-1
@@ -8,7 +8,7 @@ from PLUGINS.SIRP.nocolyapi import WorksheetRow
|
||||
from PLUGINS.SIRP.nocolymodel import AccountModel, Condition, Group, Operator
|
||||
from PLUGINS.SIRP.sirpbase import BaseWorksheetEntity
|
||||
from PLUGINS.SIRP.sirpmodel import EnrichmentModel, ArtifactModel, AlertModel, CaseModel, TicketModel, MessageModel, PlaybookModel, PlaybookJobStatus, \
|
||||
KnowledgeAction, KnowledgeModel, Severity, Confidence
|
||||
KnowledgeAction, KnowledgeModel, Severity, Confidence, PlaybookType
|
||||
|
||||
|
||||
class Enrichment(BaseWorksheetEntity[EnrichmentModel]):
|
||||
@@ -547,6 +547,31 @@ class Playbook(BaseWorksheetEntity[PlaybookModel]):
|
||||
rowid = Playbook.update(playbook_model_tmp)
|
||||
return rowid
|
||||
|
||||
@classmethod
|
||||
def add_pending_playbook(cls, type: PlaybookType, name, user_input=None, source_rowid=None, record_id=None):
|
||||
if source_rowid is None:
|
||||
if record_id is None:
|
||||
raise Exception("id is required when source_rowid is None")
|
||||
else:
|
||||
if type == PlaybookType.CASE:
|
||||
record = Case.get_by_id(record_id)
|
||||
source_rowid = record.rowid
|
||||
elif type == PlaybookType.ALERT:
|
||||
record = Alert.get_by_id(record_id)
|
||||
source_rowid = record.rowid
|
||||
elif type == PlaybookType.ARTIFACT:
|
||||
record = Artifact.get_by_id(record_id)
|
||||
source_rowid = record.rowid
|
||||
|
||||
model = PlaybookModel()
|
||||
model.source_rowid = source_rowid
|
||||
model.job_status = PlaybookJobStatus.PENDING
|
||||
model.type = type
|
||||
model.name = name
|
||||
model.user_input = user_input
|
||||
rowid = Playbook.create(model)
|
||||
return rowid
|
||||
|
||||
|
||||
class Knowledge(BaseWorksheetEntity[KnowledgeModel]):
|
||||
"""PlaybookLoader 实体类"""
|
||||
|
||||
Reference in New Issue
Block a user