Skip to content

monish4030/IntelliGuard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ IntelliGuard: AI Intrusion Detection System

Made By Monish Paramasivam

An advanced, portfolio-grade AI-powered Intrusion Detection System (IDS) built with Python and Machine Learning. IntelliGuard uses an Isolation Forest algorithm to detect anomalous network and login behavior in real time, with a clean CLI dashboard, structured logging, and severity-based alerting.


๐Ÿ“ธ Example Output

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘         AI-POWERED INTRUSION DETECTION SYSTEM  v1.0.0               โ•‘
โ•‘  Made By: Monish Paramasivam                  
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  ๐Ÿšจ  [HIGH ALERT]  2025-06-01 03:22:11
  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  IP Address     : 45.112.88.201
  Event Type     : BRUTE_FORCE
  Request Rate   : 38.4 req/min
  Failed Logins  : 24
  Login Attempts : 47
  Anomaly Score  : -0.6214

  DETECTION REASONS:
    โ–บ High failed login count (24 failures) โ€” possible brute-force attack
    โ–บ Excessive login attempts (47) from single session
    โ–บ Activity at unusual hour (03:00) โ€” off-hours access pattern
  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

๐Ÿš€ Features

Feature Details
ML Model Isolation Forest (unsupervised anomaly detection)
Attack Types Brute Force, Rapid Requests/DoS, Directory Scan, Mixed
Severity Levels LOW / MEDIUM / HIGH based on anomaly score
Logging CSV-based structured event log with timestamps
Explainability Human-readable reason for every alert
Score Visualization Text-based sparkline chart of anomaly scores
Config-Driven All thresholds in config.json โ€” no hardcoding
Modular Code Clean separation: ML, simulator, logger, CLI

๐Ÿ“ Project Structure

IntelliGuard/
โ”‚
โ”œโ”€โ”€ main.py                    โ† CLI dashboard (entry point)
โ”œโ”€โ”€ config.json                โ† Thresholds, model settings, simulation params
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ”‚
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ ml_engine.py           โ† Isolation Forest model: train, predict, explain
โ”‚   โ”œโ”€โ”€ simulator.py           โ† Traffic event generators (normal + attack types)
โ”‚   โ”œโ”€โ”€ detector.py            โ† Detection pipeline: orchestrates everything
โ”‚   โ””โ”€โ”€ logger.py              โ† Structured CSV logging + alert formatting
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ dataset_generator.py   โ† Synthetic dataset generator
โ”‚   โ””โ”€โ”€ network_events.csv     โ† Generated dataset (auto-created on first run)
โ”‚
โ”œโ”€โ”€ models/
โ”‚   โ”œโ”€โ”€ isolation_forest.pkl   โ† Trained model (auto-created)
โ”‚   โ””โ”€โ”€ scaler.pkl             โ† Feature scaler (auto-created)
โ”‚
โ””โ”€โ”€ logs/
    โ””โ”€โ”€ intelliguard.log       โ† Event log CSV (auto-created)

โš™๏ธ Setup Instructions

1. Clone or download the project

git clone https://github.com/monish4030/IntelliGuard.git
cd IntelliGuard

2. (Optional) Create a virtual environment

python -m venv venv
source venv/bin/activate      # Linux/Mac
venv\Scripts\activate         # Windows

3. Install dependencies

pip install -r requirements.txt

4. Run IntelliGuard

python main.py

On first launch, the system will automatically:

  • Generate a synthetic training dataset
  • Train the Isolation Forest model
  • Save the model to models/

๐Ÿง  How the ML Model Works

Algorithm: Isolation Forest

Isolation Forest is an unsupervised anomaly detection algorithm ideal for cybersecurity because it doesn't require labeled attack data to train.

Core Intuition:

Anomalies are rare and different. They are much easier to isolate than normal data points.

How it isolates:

  1. Randomly select a feature (e.g., request_rate)
  2. Randomly pick a split value between the feature's min and max
  3. Keep splitting until the point is isolated in its own leaf
  4. Repeat across 200 trees

Anomaly Score:

  • A point that gets isolated quickly (few splits) = anomaly โ†’ score near -1.0
  • A point requiring many splits = normal โ†’ score near +1.0

Features used for training:

Feature Description
request_rate Requests per minute from this IP
failed_logins Number of failed login attempts
session_duration How long the session lasted (seconds)
unique_endpoints Number of different pages/endpoints accessed
bytes_transferred Total data transferred in session
login_attempts Total login attempts (success + failure)
hour_of_day Time of activity (0โ€“23)

Severity Classification:

Score Range Severity
score > -0.10 NORMAL
-0.30 < score โ‰ค -0.10 LOW
-0.50 < score โ‰ค -0.30 MEDIUM
score โ‰ค -0.50 HIGH

๐ŸŽฎ Menu Options

1.  Simulate Normal Traffic           โ†’ Generate and detect normal events
2.  Simulate Attack (Brute Force)     โ†’ Repeated failed logins
3.  Simulate Attack (Rapid Requests)  โ†’ High-frequency request flood
4.  Simulate Attack (Directory Scan)  โ†’ Endpoint scanning behavior
5.  Simulate Mixed Attack             โ†’ Combination of all attack types
6.  View Event Logs                   โ†’ Tabular view of recent events
7.  Run Detection on Full Dataset     โ†’ Batch mode + model metrics
8.  Train / Retrain Model             โ†’ Force retrain from fresh data
9.  Show Anomaly Score Chart          โ†’ ASCII visualization of scores
10. Clear Logs                        โ†’ Reset log file
11. About IntelliGuard                โ†’ Project info and ML explanation
0.  Exit

๐Ÿ”ง Configuration (config.json)

All system thresholds are configurable:

{
  "model": {
    "contamination": 0.05,
    "n_estimators": 200
  },
  "thresholds": {
    "brute_force_attempts": 5,
    "rapid_request_rate": 20,
    "anomaly_score_high": -0.5,
    "anomaly_score_medium": -0.3
  }
}

๐Ÿ”ฎ Future Upgrade Suggestions

Upgrade Description
Web Dashboard Flask/FastAPI + React frontend for real-time visualization
Live Packet Capture Use scapy or pyshark to analyze real network packets
Database Storage Replace CSV logs with SQLite or PostgreSQL
Email/Slack Alerts Push HIGH severity alerts via SMTP or webhooks
LSTM / Autoencoder Deep learning models for temporal sequence anomalies
GeoIP Lookup Enrich IP data with geolocation (MaxMind GeoLite2)
Docker Deployment Containerize for easy deployment on any host
SIEM Integration Export logs in CEF/SYSLOG format for SIEM tools

๐Ÿ“ฆ Dependencies

scikit-learn >= 1.3.0   # Isolation Forest
pandas       >= 2.0.0   # Data manipulation
numpy        >= 1.24.0  # Numerical operations
joblib       >= 1.3.0   # Model persistence

๐Ÿ‘จโ€๐Ÿ’ป Author

Made By Monish Paramasivam

Built as a portfolio-grade cybersecurity project demonstrating:

  • Machine Learning applied to security (anomaly detection)
  • Clean modular Python architecture
  • Realistic threat simulation and detection
  • Production-style logging and alerting

About

๐Ÿ›ก๏ธ AI-powered Intrusion Detection System using Isolation Forest ML โ€” detects brute force, DoS, and scanning attacks in real-time with severity-based alerting and CLI dashboard. its a detection system for your desktop ,๐Ÿ›ก THIS WILL PROTECT YOU FROM HACKERS๐Ÿ›ก

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages