How hetshah1432/intrusion-detection-system works
Project Type and Purpose
• The project is a network security application that combines network scanning (to detect active devices and open ports) with anomaly detection (using an Isolation Forest model).
• It also integrates external tools (Wireshark, Snort/Suricata) for packet analysis, suggesting that some components interact with external systems to enhance security analysis.
Analyzing the File Structure
• At the top level, you have key directories:
– "data": Stores scan results and log files.
– "models": Contains the trained machine learning model (anomaly_detector.pkl).
– "scripts": Contains core scripts such as network_scanner.py, port_scanner.py, and anomaly_detection.py.
– "main.py": Acts as the main entry point that triggers different operations (scanning vs. detection).
• Configuration (requirements.txt) and licensing/documentation files round out the project, but the core architectural components reside in the main script, scripts, data, and models directories.
Components
a. Main Application/Controller:
– Represent main.py as the entry point that routes commands (e.g., --scan and --detect) to the appropriate modules.
b. Network Scanning Modules:
– Identify two main scanning components in the scripts folder:
• network_scanner.py: For discovering active devices.
• port_scanner.py: For determining open ports.
– Illustrate how these modules feed raw network data into the system.
c. Anomaly Detection Module:
– Highlight anomaly_detection.py which uses an Isolation Forest model.
– Show the dependency on the saved model (anomaly_detector.pkl in the models directory).
– Indicate that this module processes network scan data to detect suspicious patterns.
d. Data Handling:
– Include the “data” directory that holds CSV files (network_scan_data.csv, port_scan_results.csv) acting as persistent storage for scan results.
– Optionally note where logs may eventually reside (as per README, even if the current file tree doesn’t include a 'logs' directory).
e. External Tools / Integrations:
Relationships and Data Flow
• If applicable, include feedback loops for real-time monitoring, where detected anomalies may trigger further scans or alerts.
Architectural Patterns and Design Principles
• Modularity by defining separate components for scanning, anomaly detection, and data handling.
• Use of a machine learning pipeline where raw network data is processed and fed into a pre-trained model for anomaly detection.
• That the design follows a clear separation of concerns: scanning responsibilities are isolated from the detection logic and external tool interfacing.
• Although it’s a relatively simple architecture, it demonstrates a layered approach (input → processing → storage → alerting).