Skip to content

nishchal-11/TARS-navy

Repository files navigation

⚓ Naval AI Intrusion Detection System

SWAVLAMBAN 2025 - Naval Innovathon Hackathon
AI-powered network intrusion detection using Mamba-2 deep learning architecture.

🎯 Performance

Metric Value
Detection Rate 99.4%
False Positive Rate 15.6%
Inference Latency < 10ms

🚀 Quick Start

1. Setup Environment

# Clone and enter directory
cd naval-ai-ids

# Create virtual environment
python -m venv venv

# Activate (Windows)
.\venv\Scripts\activate

# Activate (Linux/Mac)
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Install PyTorch with CUDA (adjust for your CUDA version)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

2. Configure API Key (Optional - for AI rule generation)

# Copy example and add your Groq API key
copy .env.example .env
# Edit .env and add your GROQ_API_KEY

Get free API key at: https://console.groq.com

3. Run Dashboard

streamlit run src/app.py --server.port 8513

4. Run Traffic Simulator (Optional)

# In separate terminal
python src/simulator.py --count 50 --speed 2

📁 Project Structure

├── src/
│   ├── app.py                 # Main dashboard (Streamlit)
│   ├── inference_engine.py    # GPU inference engine
│   ├── mamba_model.py         # Mamba-2 autoencoder architecture
│   ├── genai_rules.py         # AI rule generation (Groq/Llama-3)
│   ├── feedback_system.py     # Continuous learning
│   ├── simulator.py           # Traffic simulator
│   └── csv_preprocessor.py    # Data preprocessing
├── models/
│   ├── mamba_enhanced.pth     # Trained model weights
│   └── threshold_enhanced.npy # Detection threshold
├── data/
│   └── *.csv                  # CIC-IDS2017 dataset
├── requirements.txt
└── README.md

🏗️ Architecture

┌─────────────────────────────────────────┐
│         MAMBA-2 ANOMALY DETECTOR        │
│            (GPU-Accelerated)            │
│                                         │
│  • Trained on NORMAL traffic only       │
│  • Reconstruction error = anomaly score │
│  • score > threshold → ATTACK           │
└─────────────────────────────────────────┘

One-Class Classification: Model learns normal patterns. Attacks produce high reconstruction error → detected.

⚙️ Key Features

  • 🔥 Real-time Detection - GPU-accelerated Mamba-2 model
  • 🤖 AI Rule Generation - Llama-3 generates WAF rules via Groq API
  • 📊 Live Dashboard - Streamlit-based command center
  • 🔄 Continuous Learning - Feedback system improves accuracy
  • 📈 XAI Explanations - Gradient-based feature importance

🔧 Requirements

  • Python 3.10+
  • NVIDIA GPU with CUDA support
  • 6GB+ VRAM recommended

📝 License

Naval Innovathon 2025 - Challenge 3

About

using mamba2 architecture to build this coool shit

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages