This Intrusion Detection and Prevention System (IDPS) is designed to detect and mitigate various network and system-based attacks using machine learning-based anomaly detection, file system monitoring, and real-time system monitoring. The system aims to identify malicious activity, log suspicious behavior, and simulate attacks to test its effectiveness.
The attack simulation module generates malicious traffic and behaviors to test the effectiveness of the IDPS. It includes:
-
SYN Flood Attack: Simulates excessive SYN requests to overwhelm a target.
-
UDP Flood Attack: Sends large amounts of UDP packets to exhaust resources.
-
Slowloris Attack: Maintains half-open connections to exhaust server resources.
-
ICMP Flood Attack: Generates excessive ICMP Echo Request packets.
-
SQL Injection Logging: Detects and logs potential SQL injection attempts.
-
Fake Bot Traffic Generation: Simulates bot-like activity to detect abnormal behaviors.
-
NOTE: These attack simulators can be illegal in some cases as it can greatly decrease the wifi speed. So kindly have some sort of permissions before executing it.
A Machine Learning-based anomaly detection system using Isolation Forest to detect suspicious activities in system logs and network traffic. It includes:
- Feature extraction from network traffic and system events.
- Unsupervised learning approach to classify deviations from normal behavior.
- Threshold-based alerting mechanism for detected anomalies.
- Accuracy Calculation: Evaluates the model's effectiveness by comparing predictions with labeled data.
- Adaptive Learning: Continuously updates the model with new data to improve detection accuracy.
This module continuously monitors file system changes and logs malicious activities. It detects:
- File modifications: Alerts when a file is changed unexpectedly.
- File creations: Monitors newly created files.
- File deletions: Tracks deleted files for potential malware activities.
- File movements: Detects file renaming or relocation attempts.
Monitors processes and network activity to detect abnormal behavior. Includes:
- Process Monitoring: Detects unauthorized or suspicious process executions.
- Network Traffic Analysis: Inspects network packets for anomalies.
- System Resource Usage: Tracks CPU and memory consumption to identify potential attacks.
- Connecting IDPS to Snort: Integrating anomaly detection with Snort for enhanced real-time network intrusion detection.
- Hybrid Approach: Combining signature-based and anomaly-based detection for better accuracy.
- Deep Learning Integration: Implementing autoencoders or LSTMs for advanced anomaly detection.
- Real-time Threat Intelligence Feeds: Incorporating external threat intelligence sources to enhance detection capabilities.
- Automated Attack Mitigation: Developing countermeasures that respond to detected attacks by blocking IPs or isolating compromised processes.
- Graph-based Intrusion Detection: Leveraging graph neural networks (GNNs) for better detection of sophisticated attack patterns.
- Multi-agent Collaboration: Enabling communication between multiple IDPS instances for distributed attack detection.
- Cloud and IoT Security: Expanding detection capabilities for cloud environments and IoT devices.
The IDPS has potential applications in several research areas:
- Adversarial Attack Resilience: Studying how adversarial machine learning can be used to evade detection and developing robust defense mechanisms.
- Explainable AI (XAI) for Intrusion Detection: Making anomaly detection interpretable and justifiable for security analysts.
- Federated Learning for Collaborative Threat Detection: Enabling decentralized learning models for distributed attack detection.
- Honeypot Integration: Enhancing detection capabilities by collecting and analyzing attacker tactics using honeypots.
- Zero-day Attack Detection: Improving the IDPS's ability to detect previously unseen attacks through dynamic learning models.
- Python (Latest Version)
- Scikit-learn
- Pandas
- NumPy
- TensorFlow/PyTorch (for future deep learning integration)
-
Clone the repository:
git clone https://github.com/Manavagg2003/Intrusion-Detection-Prevention-System.git
-
Run the attack simulator:
python attack_simulator.py
-
Start the anomaly detection module:
python detector.py
-
Finally run your IDS:
python idps.py
-
To convert your logs into csv for model training:
python conversion.py
-
To train your model:
python training.py
Note:
- Now you can just skip part 3 and 4 and just run python idps.py
- And also skip part 2 and 6 and just run python training.py
- attack_simulator.py: Generates all types of attacks mentioned above.
- conversion.py: Convert your log files into simple csv file for model training.
- detector.py: Start the anomaly detection module.
- idps.py: Main idps.
- monitor.py: Create logs for network analysis and file analysis.
- training.py: To train our isolation forest based idps model. You also get to chose if you want to start the attack_simulator.py then train the model or not.
My current accuracy after training the model with benchmark database and self-database after full day of training came out to be 99% for now
This IDPS provides an integrated approach to intrusion detection and prevention, leveraging machine learning, real-time monitoring, and attack simulation. Future enhancements will improve detection accuracy, automation, and resilience against sophisticated cyber threats.
This is the first stage of IDPS. I have a lot of improvements to do, including connecting my model with Snort for better performance and many more. Also, I will keep the GitHub repository updated!!