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.
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.
ainetguardian-demo.mov
- 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
- 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
- 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
- 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
- Python 3.8 or higher
- pip package manager
- Git (for cloning)
-
Clone the Repository
git clone https://github.com/yourusername/ai-network-security-dashboard.git cd ai-network-security-dashboard -
Create Virtual Environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Train the Model (Optional - Pre-trained model included)
python train_enhanced.py
-
Run the Application
streamlit run app.py
-
Access the Dashboard Open your browser and navigate to
http://localhost:8501
- Navigate to Real-time Analysis: Select "Real-time URL Analysis" from the sidebar
- Input URLs: Enter one or more URLs in the text area (one per line)
- Analyze: Click "π Analyze URLs" to get instant results
- 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;--- Upload CSV File: Use the file uploader (supports up to 200MB)
- CSV Format: Ensure your CSV contains a 'url' column
- Process: Click "π Start Analysis" for bulk processing
- Download Results: Export analyzed data with threat classifications
- View comprehensive metrics including accuracy, precision, recall
- Analyze confusion matrices and ROC curves
- Examine feature importance rankings
- Review cross-validation results
The enhanced Random Forest model achieves impressive performance metrics:
| Metric | Score |
|---|---|
| Accuracy | 94.1% |
| Precision | 90.9% |
| Recall | 100% |
| F1-Score | 95.2% |
- 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
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 featuresClassifies 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.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 = Falseai-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
# 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')"- 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
- Fork this repository
- Connect to Streamlit Cloud
- Deploy with one click
- Access your live dashboard
- 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
- β¨ Enhanced UI with modern animations
- π Improved model performance (95.8% accuracy)
- π Advanced traffic classification
- π¨ Dark/Light mode support
- π Large file processing (200MB+)
