Spaces:
Sleeping
Download README.md from bchoudha/C7HackathonGroup4: direct link, hf CLI and curl.
- Browser
- Download file 9.67 kB
-
https://huggingface.co/spaces/bchoudha/C7HackathonGroup4/resolve/main/README.md
- Command line
-
hf download hf://spaces/bchoudha/C7HackathonGroup4/README.md
-
curl -L -o README.md https://huggingface.co/spaces/bchoudha/C7HackathonGroup4/resolve/main/README.md
A newer version of the Gradio SDK is available: 6.32.0
title: C7HackathonGroup4
app_file: app.py
sdk: gradio
sdk_version: 6.18.0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β CyberSecurity Multi-Agent System β β LangGraph Β· Ollama Β· HuggingFace Β· LlamaIndex Β· ChromaDB Β· @tool β β Gradio Web UI β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββ STACK OVERVIEW βββββββββββββββββββββββββββββββββββββββ
Component Role βββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββ LangGraph Orchestrates agents as a compiled state machine Ollama Local LLM runtime (gpt-oss:120b-cloud) LangChain @tool Utility tools callable inside agent nodes HuggingFace Local sentence-transformer embeddings (no API key) LlamaIndex RAG framework β document indexing + retrieval ChromaDB Persistent vector store (local disk) Gradio Interactive web UI for analysis & visualization
βββββββββββββββββββββββββββββββββββββββ QUICK START βββββββββββββββββββββββββββββββββββββββ
Install dependencies: pip install -r requirements.txt
Set your credentials in cs.env: OPENROUTER_API_KEY=sk-or-... (if using OpenRouter) GRADIO_USER=admin GRADIO_PASSWORD=CyberSec@2026! LANGSMITH_API_KEY=lsv2_pt_... (optional, for tracing) LANGSMITH_TRACING=true (set false to disable)
(Change the default password before deploying)
Run the Gradio web UI: python cybersecurityGradio.py
This opens a browser-based interface with:
- Scenario selector (4 built-in examples + custom input)
- Tabbed results: Report, Log Findings, Threat Intel, Vulnerabilities, Compliance, Trace
- Green β status indicators showing initialization state
Run via CLI (headless): python cybersecurityAgents.py ssh_brute_force python cybersecurityAgents.py vulnerable_code python cybersecurityAgents.py docker_misconfig python cybersecurityAgents.py policy_audit
Run programmatically: from cybersecurityAgents import run_analysis results = run_analysis("your logs or code here")
βββββββββββββββββββββββββββββββββββββββ PROJECT FILES βββββββββββββββββββββββββββββββββββββββ
File Purpose ββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββ cybersecurityAgents.py Core multi-agent system (LangGraph pipeline) cybersecurityGradio.py Gradio web UI wrapper cs.env API keys (OPENROUTER_API_KEY) requirements.txt Python dependencies README.md This file claude.md Gradio integration analysis & architecture skill.md Team skills & technology breakdown
βββββββββββββββββββββββββββββββββββββββ VECTOR STORE PERSISTENCE βββββββββββββββββββββββββββββββββββββββ
The system checks if ChromaDB already has indexed data on startup:
- If ./chroma_cybersec_db/ exists with data β loads existing index (fast)
- If not β indexes the knowledge base into ChromaDB (first run only)
The Gradio UI displays green β checkboxes showing: β OpenRouter LLM Connected β HuggingFace Embeddings Loaded β ChromaDB + LlamaIndex Vector Store (loaded existing / freshly indexed) β LangGraph Pipeline Compiled
Use the "π Check Status" button to inspect without running analysis.
βββββββββββββββββββββββββββββββββββββββ AGENTS & LANGGRAPH FLOW βββββββββββββββββββββββββββββββββββββββ
[Input] β βΌ classify_input β Detects if input is log/code/config/policy β βΌ rag_retrieve β LlamaIndex retrieves relevant KB chunks from ChromaDB β βΌ log_monitor β Detects attacks, anomalies, IoCs β βΌ threat_intel β Maps to CVEs, MITRE ATT&CK, threat actors β βΌ vuln_scanner β OWASP/CWE vulnerability assessment β βΌ incident_response β NIST 800-61 playbook with 3-phase timeline β βΌ policy_checker β NIST CSF / ISO 27001 / SOC 2 gap analysis β βΌ synthesize_report β Combines all outputs into final report β βΌ [Report + JSON saved to disk]
βββββββββββββββββββββββββββββββββββββββ GRADIO WEB UI βββββββββββββββββββββββββββββββββββββββ
Launch: python cybersecurityGradio.py
Features:
- Login gate (username/password from cs.env)
- Dropdown to select built-in scenarios or paste custom input
- Tabbed output panels (Report, Findings, Threat Intel, Vulns, Compliance, Trace)
- Real-time system status panel with green β checkboxes
- Singleton pipeline β initializes once, reuses across requests
- Vector store persistence check β skips re-indexing if data exists
- Rate limiting (30s cooldown between requests)
- Input validation (max 10,000 characters)
- Localhost-only binding (no external network access)
Architecture: ββββββββββββββββ βββββββββββββββββββββββββ ββββββββββββββββββββ β Gradio UI ββββββββΆβ cybersecurityAgents ββββββββΆβ LangGraph β β (Browser) βββββββββ (pipeline singleton) βββββββββ Pipeline β ββββββββββββββββ βββββββββββββββββββββββββ ββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββ MODEL OPTIONS (OpenRouter) βββββββββββββββββββββββββββββββββββββββ
Free tier (no billing required): mistralai/mistral-7b-instruct β Default meta-llama/llama-3.1-8b-instruct:free google/gemma-2-9b-it:free
Paid (higher quality): openai/gpt-4o anthropic/claude-3-5-sonnet mistralai/mixtral-8x7b-instruct
Change in Config.LLM_MODEL in cybersecurityAgents.py
βββββββββββββββββββββββββββββββββββββββ EMBEDDING OPTIONS (HuggingFace, all local) βββββββββββββββββββββββββββββββββββββββ
sentence-transformers/all-MiniLM-L6-v2 β Default (90MB, fast)
BAAI/bge-base-en-v1.5 β Better quality (440MB)
sentence-transformers/all-mpnet-base-v2 β Balanced (~420MB)
βββββββββββββββββββββββββββββββββββββββ OUTPUT FILES βββββββββββββββββββββββββββββββββββββββ
cybersec_report_YYYYMMDD_HHMMSS.txt β Human-readable report cybersec_results_YYYYMMDD_HHMMSS.json β Structured JSON for all agents ./chroma_cybersec_db/ β Persistent ChromaDB vector store
βββββββββββββββββββββββββββββββββββββββ EXTENDING THE SYSTEM βββββββββββββββββββββββββββββββββββββββ
Add knowledge to the RAG database: kb.add_document("Your threat intel text...", {"category": "threat_intel"})
Add a new agent:
- Write a node function: def node_my_agent(state) β state
- graph.add_node("my_agent", node_my_agent)
- graph.add_edge("policy_checker", "my_agent")
- Add result key to CyberAgentState TypedDict
Add conditional routing (e.g., only run incident response for CRITICAL): graph.add_conditional_edges( "vuln_scanner", lambda s: "incident_response" if s["vuln_scan"]["risk_score"] > 70 else "policy_checker", {"incident_response": "incident_response", "policy_checker": "policy_checker"} )