Implement AI workspace and mitigation workflow

This commit is contained in:
2026-02-15 04:27:28 +00:00
parent de2b9a9bbb
commit 2d3b8fdac6
64 changed files with 7669 additions and 769 deletions

View File

@@ -1,26 +1,25 @@
import aiomysql
from core.util import logs
from core.schemas import mc_s
from core.util import logs
mysql_pool = None
log = logs.get_logger("sql")
DB_URL = "giadb"
async def init_mysql_pool():
"""
Initialize the MySQL connection pool.
"""
global mysql_pool
mysql_pool = await aiomysql.create_pool(
host=DB_URL,
port=9306,
db="Manticore",
minsize=1,
maxsize=10
host=DB_URL, port=9306, db="Manticore", minsize=1, maxsize=10
)
async def close_mysql_pool():
"""Close the MySQL connection pool properly."""
global mysql_pool
@@ -42,11 +41,9 @@ async def create_index():
for name, schema in schemas.items():
schema_types = ", ".join([f"{k} {v}" for k, v in schema.items()])
create_query = (
f"create table if not exists {name}({schema_types}) engine='columnar'"
)
create_query = f"create table if not exists {name}({schema_types}) engine='columnar'"
log.info(f"Schema types {create_query}")
await cur.execute(create_query) # SQLi
await cur.execute(create_query) # SQLi
except aiomysql.Error as e:
log.error(f"MySQL error: {e}")
@@ -60,4 +57,4 @@ async def main():
created = True
except Exception as e:
log.error(f"Error creating index: {e}")
await asyncio.sleep(1) # Block the thread, just wait for the DB
await asyncio.sleep(1) # Block the thread, just wait for the DB