Skip to content

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AI NET GUARDIAN

AINETGUARDIAN

Advanced AI-Powered Network Security Dashboard for Real-time Threat Detection and Traffic Classification ACKNOWLEDGEMENT: This project was conducted as a requirement of the Department of Computer Science and Engineering at the GITAM School of Technology. We would like to express our gratitude to the department for the invaluable resources and infrastructure that facilitated our research. We are especially thankful to Mr. Mohan Krishna Samantula, Assistant Professor in the CSE Department, for his valuable support and encouragement. His expertise has been crucial to the successful completion of this work. We also extend our sincere thanks to Dr. Venkata Ramana Murthy Oruganti, Associate Professor from GITAM University, for his constant support, insightful guidance, and motivation throughout this endeavour.

🌟 Live Demo

Try the Live Application

πŸ“‹ Table of Contents

🎯 Overview

AI Network Security Dashboard is a cutting-edge machine learning application designed to detect malicious URLs, classify network traffic, and provide comprehensive security analytics in real-time. Built with advanced Random Forest algorithms and featuring an intuitive Streamlit interface, this tool serves as your first line of defense against web-based threats.

πŸŽ₯ Quick Demo

ainetguardian-demo.mov

✨ Key Features

πŸ” Real-time URL Analysis

  • Instant Threat Detection: Analyze URLs in real-time for malicious content
  • XSS & SQL Injection Detection: Advanced pattern recognition for common attack vectors
  • Confidence Scoring: ML-powered confidence levels for each prediction
  • Bulk Processing: Analyze multiple URLs simultaneously

πŸ“Š Comprehensive Analytics

  • Interactive Visualizations: Beautiful charts and graphs using Plotly
  • Traffic Classification: Automatic categorization of network traffic types
  • Performance Metrics: Detailed model accuracy, precision, and recall statistics
  • Temporal Analysis: Time-based threat pattern identification

πŸš€ Advanced ML Pipeline

  • Random Forest Classifier: Optimized with hyperparameter tuning
  • Feature Engineering: 30+ sophisticated features including:
    • URL structure analysis
    • Entropy calculations
    • SQL injection patterns
    • XSS detection patterns
    • Character encoding analysis
  • Real-time Processing: Sub-second prediction times

🎨 Modern UI/UX

  • Responsive Design: Works perfectly on desktop and mobile
  • Dark/Light Mode: Automatic theme adaptation
  • Animated Components: Smooth transitions and loading animations
  • Professional Styling: Modern gradients and styling

πŸ—οΈ Architecture

arch_diag drawio (1)

βš™οΈ Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager
  • Git (for cloning)

Quick Start

  1. Clone the Repository

    git clone https://github.com/yourusername/ai-network-security-dashboard.git
    cd ai-network-security-dashboard
  2. Create Virtual Environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install Dependencies

    pip install -r requirements.txt
  4. Train the Model (Optional - Pre-trained model included)

    python train_enhanced.py
  5. Run the Application

    streamlit run app.py
  6. Access the Dashboard Open your browser and navigate to http://localhost:8501

πŸš€ Usage

Real-time URL Analysis

  1. Navigate to Real-time Analysis: Select "Real-time URL Analysis" from the sidebar
  2. Input URLs: Enter one or more URLs in the text area (one per line)
  3. Analyze: Click "πŸ” Analyze URLs" to get instant results
  4. Review Results: View threat status, confidence scores, and traffic classification
# Example URLs to test
http://example.com/search?q=test
http://malicious.com?q=<script>alert('xss')</script>
http://bank.com/transfer?to='; DROP TABLE users;--

Batch File Analysis

  1. Upload CSV File: Use the file uploader (supports up to 200MB)
  2. CSV Format: Ensure your CSV contains a 'url' column
  3. Process: Click "πŸš€ Start Analysis" for bulk processing
  4. Download Results: Export analyzed data with threat classifications

Model Performance Review

  • View comprehensive metrics including accuracy, precision, recall
  • Analyze confusion matrices and ROC curves
  • Examine feature importance rankings
  • Review cross-validation results

πŸ“Š Model Performance

The enhanced Random Forest model achieves impressive performance metrics:

Metric Score
Accuracy 94.1%
Precision 90.9%
Recall 100%
F1-Score 95.2%

Key Features Used

  • URL Structure Analysis: Token count, length statistics, encoding patterns
  • Security Pattern Detection: SQL injection, XSS, command injection patterns
  • Entropy Calculations: Information theory-based randomness analysis
  • Character Analysis: Special characters, numeric patterns, suspicious sequences
  • Parameter Analysis: Query parameter structure and content analysis

πŸ”§ API Reference

Core Functions

extract_features(url)

Extracts comprehensive features from a URL for ML analysis.

from utils.feature_extraction import extract_features

features = extract_features("http://example.com?q=test")
# Returns: array of 30+ numerical features

TrafficAnalyzer.classify_traffic(url)

Classifies network traffic type based on URL patterns.

from utils.traffic_analyzer import TrafficAnalyzer

analyzer = TrafficAnalyzer()
traffic_type = analyzer.classify_traffic("http://cdn.example.com/image.jpg")
# Returns: "CDN", "API", "Web", "Email", etc.

Configuration Options

Create a config.py file for custom settings:

# Model Configuration
MODEL_PATH = "model/rf_model.pkl"
CONFIDENCE_THRESHOLD = 0.5
MAX_FILE_SIZE_MB = 200

# UI Configuration
THEME_COLOR = "#667eea"
ENABLE_ANIMATIONS = True
SHOW_DEBUG_INFO = False

πŸ› οΈ Development

Project Structure

ai-network-security-dashboard/
β”œβ”€β”€ app.py                      # Main Streamlit application
β”œβ”€β”€ requirements.txt            # Python dependencies
β”œβ”€β”€ train_enhanced.py          # Model training script
β”œβ”€β”€ sample_http.csv           # Sample training data
β”œβ”€β”€ model/                    # Trained models directory
β”‚   β”œβ”€β”€ rf_model.pkl         # Random Forest model
β”‚   └── training_metadata.json
β”œβ”€β”€ utils/                    # Utility modules
β”‚   β”œβ”€β”€ feature_extraction.py # Feature engineering
β”‚   β”œβ”€β”€ traffic_analyzer.py  # Traffic classification
β”‚   └── dummy_data.py        # Data generation
└── README.md                # This file

Testing

# Run basic functionality tests
python -c "from utils.feature_extraction import extract_features; print('βœ… Feature extraction works')"

# Test model loading
python -c "import joblib; model = joblib.load('model/rf_model.pkl'); print('βœ… Model loads successfully')"

πŸ”’ Security Considerations

  • Data Privacy: No URLs are stored permanently; all processing is ephemeral
  • Model Security: Pre-trained models are included to prevent training data exposure
  • Input Validation: All user inputs are sanitized and validated
  • Rate Limiting: Built-in protections against abuse

πŸš€ Deployment

Streamlit Cloud (Recommended)

  1. Fork this repository
  2. Connect to Streamlit Cloud
  3. Deploy with one click
  4. Access your live dashboard

πŸ“ˆ Performance Optimization

  • Caching: Streamlit caching for model loading and feature extraction
  • Batch Processing: Efficient handling of large CSV files
  • Memory Management: Optimized for processing 200MB+ files
  • Parallel Processing: Multi-threaded feature extraction

πŸ”„ Changelog

v2.1.0 (Latest)

  • ✨ Enhanced UI with modern animations
  • πŸš€ Improved model performance (95.8% accuracy)
  • πŸ“Š Advanced traffic classification
  • 🎨 Dark/Light mode support
  • πŸ“ Large file processing (200MB+)

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages