A robust machine learning-based system for detecting anomalies in encrypted network traffic using Autoencoder, One-Class SVM, and K-Means clustering.
- Resolved Stuck Execution: Fixed by adding feature normalization in One-Class SVM to prevent kernel underflow.
- Fixed Visualization Errors: Updated visualizer to handle results properly with error checking.
- Improved Model Training: Ensured models train with normalized data and proper thresholds.
- Performance Note: TensorFlow.js Node backend installation may fail if project path has spaces. See installation section.
- Node.js v18+ (v22 may require additional setup for native builds)
- NPM v9+
- Python 3.6+ (for native compilations if needed)
- Clone the repository:
git clone https://github.com/yourusername/network-anomaly-detection.git
cd network-anomaly-detectionImportant: If your project path has spaces (e.g., "Network Anomaly Detection"), rename folders to remove spaces before installing dependencies. Example:
mv "Network Anomaly Detection" Network-Anomaly-Detection
cd Network-Anomaly-Detection/network-anomaly-detectionThis prevents build errors during native dependency installation.
- Install dependencies:
npm install- (Optional) Install TensorFlow.js Node backend for faster performance:
npm install @tensorflow/tfjs-nodeIf installation fails (e.g., build errors), ensure no spaces in path and required build tools installed (see Troubleshooting).
npm startnpm start /path/to/capture.pcapnpm test- Model Training Errors: Ensure sufficient data; mock generator provides ~2000 packets.
- TypeError in Visualizer: Update to latest code with fixed visualizer.
- SVM Prediction Error: Fixed by normalization; pull latest changes.
- node-pre-gyp build failures: Often due to spaces in path or missing build tools.
- macOS: Install Xcode Command Line Tools:
xcode-select --install - Also install:
brew install pkg-config cairo pango libpng jpeg giflib librsvg
- macOS: Install Xcode Command Line Tools:
- No pre-built binaries: Try older Node.js version (e.g., v20) or build from source.
- Heap Out of Memory: Run with
node --max-old-space-size=4096 src/index.js
DEBUG=* npm startsrc/capture/: Packet capturing and readingsrc/detection/: Anomaly models and detectorsrc/features/: Feature extractionsrc/utils/: Helper functionssrc/visualization/: Results displaysrc/index.js: Main entry
MIT License - see LICENSE file.