How ngobao2002/classifying-and-detecting-malware-by-using-densenet-graduation-project works
Project Type and Purpose
• This is a Python-based “full-stack” machine-learning web application built with Streamlit.
• Purpose: Allow users to convert executables to images, classify malware into 25 categories, and detect benign vs. malicious files using pre-trained DenseNet models.
File Structure
Top-level files & folders:
• Homepage.py – Streamlit entry point and navigation hub
• README.md – project overview, data sources, setup instructions
• code to train model in here/ – Jupyter notebooks for training and experimenting with DenseNet on malware datasets
• example_malware_images/ – sample image data for visualization or testing
• exe_to_bytes/ – raw .bytes representations of executables (Big2015 dataset)
• model_in_here/ – pre-trained Keras .h5 models for classification/detection
• pages/ – modular Streamlit pages that implement:
– Classification_25.py (25-class malware classification)
– Classification_DenseNet_Ver.py (alternate architecture/classifier)
– Detect_25.py, Detect_DenseNet_Ver.py (binary detection)
– ExetoByte.py (convert .exe → .bytes)
– bytetoimg.py (convert .bytes → image)
• tmp/ – temporary storage of uploaded .exe files for demo/testing
README for Technical Stack
• Python 3.x, Streamlit for UI
• TensorFlow/Keras DenseNet architecture saved in .h5
• Data processing: converting .exe → byte arrays → grayscale images
• External storage: Google Drive for hosting datasets and model files
a. Data Sources
– MalImg dataset (downloaded images)
– Big2015 dataset (.exe → .bytes)
– Benign dataset (Dike)
– External Google Drive for both datasets & model storage
b. Preprocessing Layer
– exe_to_bytes module (raw .exe → .bytes files)
– bytetoimg module (byte files → grayscale images)
c. Model Training & Storage
– Jupyter Notebooks in “code to train model in here/”
– Training pipelines: load images → DenseNet training → save .h5
– model_in_here/detect.h5 as the deployed artifact
d. Streamlit Web Application
– Homepage.py orchestrates navigation
– Pages sub-modules implement each feature: classification, detection, converters
e. External Services
– Google Drive (for downloading models & datasets)
– Optional: Git/GitHub for code versioning
Relationships & Data Flow
1. User uploads .exe via Streamlit → tmp/
2. ExetoByte page: reads tmp/.exe → generates .bytes in exe_to_bytes/
3. bytetoimg page: converts .bytes → image, passes it to classification/detection pages
4. Classification/Detection pages: load image → feed into pre-trained .h5 model → output class or binary label
5. All pages served by Homepage.py in Streamlit
Architectural Patterns & Design Principles
– Modular UI: Each functionality in its own Streamlit page (separation of concerns)
– Layered design: Data ingestion → preprocessing → inference → presentation
– Reuse of common artifacts: exe_to_bytes and bytetoimg modules used by both classification & detection