A proactive Windows download interception and malware analysis framework.
Instead of waiting until after execution, the framework watches the Downloads folder, intercepts newly arrived files, performs static analysis, and either releases or quarantines the file before the user can open it.
- Real-time monitoring of the Windows
Downloadsfolder. - PDF malware detection using a trained XGBoost model over 31 structural features.
- Word document detection for
.docxand.docusing macro, IOC, DDE, and obfuscation checks. - PE
.exedetection using static PE features, with support for a dedicated ML model. - PE
.exedetection using the published EMBER2024 LightGBM PE model when available. - Safe PE fallback scoring when the PE model files have not been trained or added yet.
- System tray dashboard with scan history, risk levels, and quarantine actions.
- Automatic quarantine for files at or above the configured risk threshold.
- file_monitor.py watches the Downloads folder with
watchdog. - New files are allowed to finish downloading, then renamed with
.scanningto lock them during analysis. - The file is routed by type:
- PDF -> pdf_feature_extractor.py
- Word -> docx_feature_extractor.py
- PE
.exe-> pe_feature_extractor.py
- The monitor decides whether to unlock the file or move it into quarantine.
- tray_app.py surfaces the result in the tray UI and dashboard.
.pdf.docx.doc.exe
Prerequisites:
- Windows 10 or 11
- Python 3.10+
Use this path first after cloning the repository. It runs the app from source so you can confirm that the environment, dependencies, and model files are working before building a packaged executable.
cd "C:\path\to\Malware-Int-Framework"
python -m venv venv
.\venv\Scripts\activate
python -m pip install -r requirements.txt
python tray_app.pyIf the virtual environment already exists, you can skip the python -m venv venv line.
Use this path only after the quick run works.
cd "C:\path\to\Malware-Int-Framework"
.\venv\Scripts\activate
python -m pip install pyinstaller
pyinstaller tray_app.specThe compiled executable will be written to dist/MalwareMonitor.exe.
Place these files in models/:
malware_classifier.pklfeature_names.pkl
Place these files in models/:
pe_malware_classifier.pklpe_feature_names.pklEMBER2024_PE.model
PE model priority:
EMBER2024_PE.modelif present- custom
pe_malware_classifier.pklif present - built-in fallback static PE scorer otherwise
The repository is already wired to the published EMBER2024 PE benchmark model format. If models/EMBER2024_PE.model is present, .exe files are scored with that model automatically.
Important: models/EMBER2024_PE.model is a LightGBM text model and must keep LF line endings. The repository includes .gitattributes to prevent Windows line-ending conversion from corrupting the file during clone or checkout.
The repository now includes train_pe_model.py, which trains a PE malware classifier from labeled .exe samples using the same runtime feature space as the PE extractor.
Expected dataset layout:
dataset/
pe/
benign/
*.exe
malicious/
*.exe
Example:
python train_pe_model.py --dataset-root dataset/peThis saves:
models/pe_malware_classifier.pklmodels/pe_feature_names.pkl
- Run the application.
- Download or copy a PDF, Word document, or
.exeinto yourDownloadsfolder. - The monitor will lock the file, scan it, and either restore or quarantine it.
- Review the result in the dashboard or in
monitor.log.
- Start with the
Quick Run / Smoke Testpath above before trying to builddist/MalwareMonitor.exe. - For PE
.exevalidation, a safe benign local executable such as the environment'spython.execan be copied into the watched folder to confirm:- the file is intercepted
- the
.scanningsuffix is removed after analysis - a dashboard history entry is written
- the justification popup matches the displayed confidence and prediction
- If a fresh Windows clone shows
LightGBMModel format error, expect a tree here, refreshmodels/EMBER2024_PE.modelafter pulling the latest repo metadata, because that usually means the model file was checked out with CRLF instead of LF line endings.
tray_app.py # System tray entry point and dashboard
file_monitor.py # Download interception and routing
pdf_feature_extractor.py # PDF static feature extraction + ML scoring
docx_feature_extractor.py # Word malware scoring
pe_feature_extractor.py # PE feature extraction + optional ML scoring
train_model.py # PDF model training pipeline
train_pe_model.py # PE model training pipeline
tray_app.spec # PyInstaller build spec
models/ # Trained model artifacts
dataset/ # Training data assets
- The original academic project focused on PDF malware detection first.
- The current codebase now extends the same interception architecture to Word and PE files.
- For a broader architectural narrative, see
PROJECT_README.md, but treat this README as the most current high-level source of truth.
- PDF inspection rundown
- DOCX inspection rundown
- EXE inspection rundown
- Copy-ready citations