mirror of
https://github.com/mblanke/ThreatHunt.git
synced 2026-03-01 14:00:20 -05:00
- Implemented PlaybookManager for creating and managing investigation playbooks with templates. - Added SavedSearches component for managing bookmarked queries and recurring scans. - Introduced TimelineView for visualizing forensic event timelines with zoomable charts. - Enhanced backend processing with auto-queued jobs for dataset uploads and improved database concurrency. - Updated frontend components for better user experience and performance optimizations. - Documented changes in update log for future reference.
40 lines
1.7 KiB
Python
40 lines
1.7 KiB
Python
from pathlib import Path
|
|
p=Path(r'd:/Projects/Dev/ThreatHunt/backend/app/services/job_queue.py')
|
|
t=p.read_text(encoding='utf-8')
|
|
old=''' if hunt_id:
|
|
job_queue.submit(JobType.HOST_PROFILE, hunt_id=hunt_id)
|
|
logger.info(f"Triage done for {dataset_id} - chained HOST_PROFILE for hunt {hunt_id}")
|
|
except Exception as e:
|
|
'''
|
|
new=''' if hunt_id:
|
|
hp_job = job_queue.submit(JobType.HOST_PROFILE, hunt_id=hunt_id)
|
|
try:
|
|
from sqlalchemy import select
|
|
from app.db.models import ProcessingTask
|
|
async with async_session_factory() as db:
|
|
existing = await db.execute(
|
|
select(ProcessingTask.id).where(ProcessingTask.job_id == hp_job.id)
|
|
)
|
|
if existing.first() is None:
|
|
db.add(ProcessingTask(
|
|
hunt_id=hunt_id,
|
|
dataset_id=dataset_id,
|
|
job_id=hp_job.id,
|
|
stage="host_profile",
|
|
status="queued",
|
|
progress=0.0,
|
|
message="Queued",
|
|
))
|
|
await db.commit()
|
|
except Exception as persist_err:
|
|
logger.warning(f"Failed to persist chained HOST_PROFILE task: {persist_err}")
|
|
|
|
logger.info(f"Triage done for {dataset_id} - chained HOST_PROFILE for hunt {hunt_id}")
|
|
except Exception as e:
|
|
'''
|
|
if old not in t:
|
|
raise SystemExit('triage chain block not found')
|
|
t=t.replace(old,new)
|
|
p.write_text(t,encoding='utf-8')
|
|
print('updated triage chain to persist host_profile task row')
|