Skip to content

IOT-Malware

IOT-Malware is a machine learning system for detecting and classifying IoT malware using neural networks and TF-IDF vectorization of function call graphs (FCGs).

Language: Python
Repository: github.com/th30d4y/IOT-Malware

The classifier targets the following IoT malware families:

  • Ddostf
  • Dofloo
  • Gafgyt
  • Mirai
  • Mobidash
  • Rootnik
  • Tsunami
LayerTechnology
LanguagePython 3.8+
Deep LearningPyTorch
Feature EngineeringScikit-learn (TF-IDF)
Data HandlingPandas, NumPy, OpenPyXL
VisualizationMatplotlib
InterfaceJupyter Notebook
Terminal window
pip install torch torchvision
pip install pandas numpy scikit-learn
pip install matplotlib tqdm openpyxl
pip install jupyter notebook

Run TF-IDF vectorization on the raw function call graph data:

Terminal window
python tfidf_vectorizer.py

This produces vectorized_tfidf.csv.

Train the MLP neural network:

Terminal window
python mlp_trainer.py

The best checkpoint is saved to optimized_gradual_model.pth.

A 4-layer MLP:

Input → 512 neurons
512 → 256 (ReLU + BatchNorm + Dropout)
256 → 128 (ReLU + BatchNorm + Dropout)
128 → num_classes (logits)
ParameterValue
Batch size32
Learning rate2e-4
Dropout rate0.4
Weight decay5e-4
Max epochs60
Early stopping patience15
  • .data files — function call edges, one caller#callee pair per line
  • .label files — malware family name per sample

Data sourced from the CyberAI2025 Dataset.

FileDescription
vectorized_tfidf.csvPrimary training feature file
optimized_gradual_model.pthBest saved model weights
test_predictions_submission.csvSubmission-ready predictions
optimized_gradual_curves.pngLoss/accuracy training plots
MetricValue
Training accuracy~95–98%
Validation accuracy~85–92%
Random baseline (7 classes)~14.3%
Inference speed< 1ms per sample
Training time15–30 min (hardware-dependent)