File size: 2,992 Bytes
41202ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
586d281
41202ed
 
 
 
 
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
license: apache-2.0
language:
- en
tags:
- cybersecurity
- intrusion-detection
- phishing-detection
- vulnerability-scoring
- machine-learning
- random-forest
- xgboost
---

# πŸ›‘οΈ Cybersecurity ML Models

A collection of machine learning models for cybersecurity threat detection and vulnerability assessment.

## Models Included

### πŸ” Intrusion Detection (UNSW-NB15)
Detects network intrusions and classifies attack types.
- **Algorithm:** Random Forest + XGBoost
- **Classes:** Normal, DoS, Exploits, Fuzzers, Generic, Reconnaissance, Backdoor, Analysis, Shellcode, Worms
- **Dataset:** UNSW-NB15

### 🎣 Phishing Detection
Identifies phishing URLs and malicious web content.
- **Algorithm:** Random Forest + XGBoost
- **Output:** Phishing / Legitimate

### πŸ›‘οΈ Vulnerability Scoring
Predicts vulnerability severity and CVSS scores.
- **Algorithm:** Random Forest + XGBoost (classifier + regressor)
- **Output:** Severity label + numeric score

---

## πŸ“ Repository Structure
```
β”œβ”€β”€ predictor.pkl                          # Main predictor (load this)
β”œβ”€β”€ preprocessors/
β”‚   β”œβ”€β”€ intrusion_label_encoder.pkl
β”‚   β”œβ”€β”€ intrusion_scaler.pkl
β”‚   β”œβ”€β”€ phishing_scaler.pkl
β”‚   β”œβ”€β”€ severity_encoder.pkl
β”‚   β”œβ”€β”€ vulnerability_scaler.pkl
β”‚   β”œβ”€β”€ intrusion_feature_names.json
β”‚   β”œβ”€β”€ phishing_feature_names.json
β”‚   └── vulnerability_feature_names.json
└── saved_models/
    β”œβ”€β”€ intrusion_detection/
    β”œβ”€β”€ phishing_detection/
    └── vulnerability_scoring/
```

---

## πŸš€ Quickstart

### Install dependencies
```bash
pip install scikit-learn xgboost joblib huggingface_hub
```

### Load the models
```python
import joblib
from huggingface_hub import hf_hub_download

# Download and load main predictor
path = hf_hub_download(repo_id="Alfeesi/cybersecurity-ml-models", filename="predictor.pkl")
predictor = joblib.load(path)
```

### Intrusion Detection
```python
import numpy as np

features = np.array([[0.5, 0, 1, 1024, 512]])  # your network features
result = predictor.predict_intrusion(features)
print(f"Attack Type: {result['attack_type']}")
```

### Phishing Detection
```python
features = np.array([[75, 1, 3, 0]])  # url_length, has_ip, num_dots, has_https
result = predictor.predict_phishing(features)
print(f"Phishing: {result}")
```

### Vulnerability Scoring
```python
features = np.array([[7.5, 0, 0]])  # cvss_base, attack_vector, complexity
result = predictor.predict_vulnerability(features)
print(f"Severity: {result['severity']} | Score: {result['score']}")
```

---

## πŸ“Š Model Performance

| Model | Metric | Score |
|-------|--------|-------|
| Intrusion Detection | Accuracy | See evaluation/ |
| Phishing Detection | Accuracy | See evaluation/ |
| Vulnerability Scoring | RMSE | See evaluation/ |

---

## πŸ”— Live Demo
https://huggingface.co/spaces/Alfeesi/cybersecurity-demo

---

## πŸ“„ License
Apache 2.0 β€” free to use, modify, and distribute.