Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- dga
|
| 5 |
+
- cybersecurity
|
| 6 |
+
- domain-generation-algorithm
|
| 7 |
+
- text-classification
|
| 8 |
+
- sklearn
|
| 9 |
+
license: mit
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# DGA-Logit: TF-IDF + Logistic Regression for DGA Detection
|
| 13 |
+
|
| 14 |
+
TF-IDF character n-grams combined with 15 lexical features and Logistic Regression, trained on 54 DGA families.
|
| 15 |
+
Part of the **DGA Multi-Family Benchmark** (Reynier et al., 2026).
|
| 16 |
+
|
| 17 |
+
## Model Description
|
| 18 |
+
|
| 19 |
+
- **Architecture:** TF-IDF (char n-grams) + 15 lexical features → StandardScaler → Logistic Regression
|
| 20 |
+
- **Features:** Length, entropy, digit/vowel ratios, consecutive runs, SLD length, etc.
|
| 21 |
+
- **Framework:** scikit-learn
|
| 22 |
+
- **File size:** ~8 MB
|
| 23 |
+
|
| 24 |
+
## Performance (54 DGA families, 30 runs each)
|
| 25 |
+
|
| 26 |
+
| Metric | Value |
|
| 27 |
+
|-----------|--------|
|
| 28 |
+
| Accuracy | 0.9277 |
|
| 29 |
+
| F1 | 0.9028 |
|
| 30 |
+
| Precision | 0.9407 |
|
| 31 |
+
| Recall | 0.8921 |
|
| 32 |
+
| FPR | 0.0367 |
|
| 33 |
+
| Query Time| 0.291 ms/domain (CPU) |
|
| 34 |
+
|
| 35 |
+
## Usage
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
from huggingface_hub import hf_hub_download
|
| 39 |
+
import importlib.util
|
| 40 |
+
|
| 41 |
+
artifacts_path = hf_hub_download("Reynier/dga-logit", "artifacts.joblib")
|
| 42 |
+
model_py = hf_hub_download("Reynier/dga-logit", "model.py")
|
| 43 |
+
|
| 44 |
+
spec = importlib.util.spec_from_file_location("logit_model", model_py)
|
| 45 |
+
mod = importlib.util.module_from_spec(spec)
|
| 46 |
+
spec.loader.exec_module(mod)
|
| 47 |
+
|
| 48 |
+
artifacts = mod.load_model(artifacts_path)
|
| 49 |
+
results = mod.predict(artifacts, ["google.com", "xkr3f9mq.ru"])
|
| 50 |
+
print(results)
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Citation
|
| 54 |
+
|
| 55 |
+
```bibtex
|
| 56 |
+
@article{reynier2026dga,
|
| 57 |
+
title={DGA Multi-Family Benchmark: Comparing Classical and Transformer-based Detectors},
|
| 58 |
+
author={Reynier et al.},
|
| 59 |
+
year={2026}
|
| 60 |
+
}
|
| 61 |
+
```
|