Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- dga
|
| 5 |
+
- cybersecurity
|
| 6 |
+
- domain-generation-algorithm
|
| 7 |
+
- text-classification
|
| 8 |
+
- keras
|
| 9 |
+
license: mit
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# DGA-LABin: BiLSTM + Attention (Keras) for DGA Detection
|
| 13 |
+
|
| 14 |
+
Bidirectional LSTM with Weighted Self-Attention (Keras) trained on 54 DGA families.
|
| 15 |
+
Part of the **DGA Multi-Family Benchmark** (Reynier et al., 2026).
|
| 16 |
+
|
| 17 |
+
## Model Description
|
| 18 |
+
|
| 19 |
+
- **Architecture:** Embedding(128) → BiLSTM(128) → SeqWeightedAttention → Dense → sigmoid
|
| 20 |
+
- **Input:** Character-level encoding, left-padded to 64 chars
|
| 21 |
+
- **Output:** Binary classification — `legit` (0) or `dga` (1)
|
| 22 |
+
- **Framework:** Keras (TensorFlow)
|
| 23 |
+
|
| 24 |
+
## Usage
|
| 25 |
+
|
| 26 |
+
```python
|
| 27 |
+
# Install dependency
|
| 28 |
+
# !pip install keras-self-attention
|
| 29 |
+
|
| 30 |
+
from huggingface_hub import hf_hub_download
|
| 31 |
+
import importlib.util
|
| 32 |
+
|
| 33 |
+
weights = hf_hub_download("Reynier/dga-labin", "LABin_best_model.keras")
|
| 34 |
+
model_py = hf_hub_download("Reynier/dga-labin", "model.py")
|
| 35 |
+
|
| 36 |
+
spec = importlib.util.spec_from_file_location("labin_model", model_py)
|
| 37 |
+
mod = importlib.util.module_from_spec(spec)
|
| 38 |
+
spec.loader.exec_module(mod)
|
| 39 |
+
|
| 40 |
+
model = mod.load_model(weights)
|
| 41 |
+
results = mod.predict(model, ["google.com", "xkr3f9mq.ru"])
|
| 42 |
+
print(results)
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Citation
|
| 46 |
+
|
| 47 |
+
```bibtex
|
| 48 |
+
@article{reynier2026dga,
|
| 49 |
+
title={DGA Multi-Family Benchmark: Comparing Classical and Transformer-based Detectors},
|
| 50 |
+
author={Reynier et al.},
|
| 51 |
+
year={2026}
|
| 52 |
+
}
|
| 53 |
+
```
|