mirror of
https://github.com/mblanke/ThreatHunt.git
synced 2026-03-01 14:00:20 -05:00
48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.api.routes import auth, users, tenants, hosts, ingestion, vt, audit, notifications, velociraptor
|
|
from app.core.config import settings
|
|
|
|
app = FastAPI(
|
|
title=settings.app_name,
|
|
description="Multi-tenant threat hunting companion for Velociraptor",
|
|
version="0.3.0"
|
|
)
|
|
|
|
# Configure CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["http://localhost:3000", "http://localhost:5173"], # Frontend URLs
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(auth.router, prefix="/api/auth", tags=["Authentication"])
|
|
app.include_router(users.router, prefix="/api/users", tags=["Users"])
|
|
app.include_router(tenants.router, prefix="/api/tenants", tags=["Tenants"])
|
|
app.include_router(hosts.router, prefix="/api/hosts", tags=["Hosts"])
|
|
app.include_router(ingestion.router, prefix="/api/ingestion", tags=["Ingestion"])
|
|
app.include_router(vt.router, prefix="/api/vt", tags=["VirusTotal"])
|
|
app.include_router(audit.router, prefix="/api/audit", tags=["Audit Logs"])
|
|
app.include_router(notifications.router, prefix="/api/notifications", tags=["Notifications"])
|
|
app.include_router(velociraptor.router, prefix="/api/velociraptor", tags=["Velociraptor"])
|
|
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
"""Root endpoint"""
|
|
return {
|
|
"message": f"Welcome to {settings.app_name}",
|
|
"version": "0.3.0",
|
|
"docs": "/docs"
|
|
}
|
|
|
|
|
|
@app.get("/health")
|
|
async def health_check():
|
|
"""Health check endpoint"""
|
|
return {"status": "healthy"}
|