A sophisticated machine learning-based system for classifying malware using advanced binary analysis and Random Forest classification. This project demonstrates the application of machine learning techniques to cybersecurity, specifically in the domain of malware detection.
- Advanced binary file analysis with multiple feature extraction methods:
- File size and basic statistics
- Shannon entropy calculation
- Byte frequency distribution analysis
- Sequential pattern detection
- Top N common sequence identification
- Random Forest-based classification with feature importance analysis
- Standardized feature scaling
- Detailed file analysis with top contributing features
- Visualization of feature importance
- Support for both malware and benign file analysis
- Test file generation for educational purposes
malware-classification-ml/
├── src/
│ ├── enhanced_malware_classifier.py
│ └── generate_test_files.py
├── data/
│ ├── malware_samples/
│ └── benign_samples/
├── results/
│ └── feature_importance.png
├── requirements.txt
└── README.md
- Clone the repository:
git clone https://github.com/Varunpoojari/malware-classification-ml.git
cd malware-classification-ml- Install the required dependencies:
pip install -r requirements.txt- First, create sample directories and generate test files:
python src/generate_test_files.py-
Add some benign files to the
data/benign_samplesdirectory for comparison. -
Run the enhanced classifier:
python src/enhanced_malware_classifier.pyThe system extracts the following features from binary files:
- File size
- Average byte value
- Shannon entropy
- Complete byte frequency distribution (256 features)
- Sequential pattern analysis
- Top 10 most common byte sequences
The enhanced system provides:
- Overall malware probability score
- Top contributing features for each analysis
- Feature importance visualization
- Detailed per-file analysis reports
- Algorithm: Random Forest Classifier
- Number of estimators: 100
- Feature scaling: StandardScaler
- Train/Test split: 80/20
- Advanced feature extraction and analysis
The system generates:
- Test accuracy metrics
- Feature importance plots (saved in results/feature_importance.png)
- Detailed analysis reports for each file
This project is designed for educational purposes to demonstrate:
- Advanced machine learning application in cybersecurity
- Sophisticated binary file analysis techniques
- Feature extraction and selection methods
- Classification algorithms application
- Data visualization and interpretation
This tool is intended for educational purposes only. It should not be used as a primary security measure or for malicious purposes. Always use proper security tools and antivirus software for real-world applications.
MIT License - See LICENSE file for details