File size: 2,900 Bytes
c1d13e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
license: apache-2.0
language: en
library_name: keras
tags:
- intrusion-detection
- network-forensics
- iot-security
- cnn
- lstm
- multiclass-classification
- cybersecurity
datasets:
- CICIoT2023
---

# Multiclass Network Forensic Intrusion Detection System

A hybrid **CNN-LSTM** model for fine-grained, multiclass intrusion detection.  
It serves as a detailed forensic tool to classify network attacks into 25 distinct categories.

## Model Description
This model acts as a "second-stage" analysis tool. After an initial threat is detected (e.g., by a binary IDS), it identifies the specific nature of the attack.  

- **Architecture:** `Conv1D -> ... -> LSTM -> Dense -> Dense (Softmax)`  
- **Dataset:** CICIoT2023 curated subset  
- **Performance:** 97% accuracy on the 25-class classification task  

## Intended Use
- **Primary Use:** Identify the type of network attack for forensic analysis.  
- **Input:** `(batch_size, 10, 46)` — 46 normalized network features  
- **Output:** Softmax probabilities over 25 classes; highest probability indicates the predicted class  

## How to Use
```python
import tensorflow as tf
import numpy as np
from huggingface_hub import hf_hub_download

# Download the model
MODEL_PATH = hf_hub_download("Codelord01/multiclass_model", "multiclass_model.keras")
model = tf.keras.models.load_model(MODEL_PATH)
model.summary()

# Define class names in the order used during training
CLASS_NAMES = [
    'BenignTraffic', 'DDoS-ACK_Fragmentation', 'DDoS-HTTP_Flood', 'DDoS-ICMP_Flood', 
    'DDoS-ICMP_Fragmentation', 'DDoS-PSHACK_Flood', 'DDoS-RSTFINFlood', 'DDoS-SYN_Flood', 
    'DDoS-SlowLoris', 'DDoS-SynonymousIP_Flood', 'DDoS-TCP_Flood', 'DDoS-UDP_Flood',
    'DDoS-UDP_Fragmentation', 'DNS_Spoofing', 'DoS-HTTP_Flood', 'DoS-SYN_Flood', 
    'DoS-TCP_Flood', 'DoS-UDP_Flood', 'MITM-ArpSpoofing', 'Mirai-greeth_flood', 
    'Mirai-greip_flood', 'Mirai-udpplain', 'OtherAttack', 'Recon-HostDiscovery', 
    'VulnerabilityScan'
]

# Sample input: 1 sample, 10 timesteps, 46 features
sample_data = np.random.rand(1, 10, 46).astype(np.float32)

# Make a prediction
prediction_probs = model.predict(sample_data)
predicted_index = np.argmax(prediction_probs)
predicted_class = CLASS_NAMES[predicted_index]
confidence = prediction_probs[predicted_index]

print(f"Predicted Attack Type: {predicted_class}")
print(f"Confidence: {confidence:.4f}")

## Limitations
- Validated only on CICIoT2023-like traffic
- Input must be normalized
- CLASS_NAMES must match training order

## Training Information
- Optimizer: Adam
- Loss: Categorical Cross-Entropy
- 25-class balanced dataset


@mastersthesis{ababio2025multilayered,
  title={A Multi-Layered Hybrid Deep Learning Framework for Cyber-Physical Intrusion Detection in Climate-Monitoring IoT Systems},
  author={Awuni David Ababio},
  year={2025},
  school={Kwame Nkrumah University of Science and Technology}
}