一键导入
dga-classifier
Compute DGA probabilities using a pre-trained RandomForest model.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Compute DGA probabilities using a pre-trained RandomForest model.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Merge Stage 2 DNS analysis scores and calculate final exfiltration verdicts.
Capture live DNS queries with tcpdump for a configurable duration, save the traffic to a PCAP file, and process it through the existing PCAP reader. Use when a user explicitly requests timed live DNS capture from a network interface.
Score DNS queries for anomalies using the trained embedding similarity model.
Calculate DNS subdomain entropy scores for exfiltration and DGA detection.
Generate a Markdown security report from aggregated DNS exfiltration scores.
Normalize DNS input from PCAP or CSV into one unified JSON dataset.
| name | dga-classifier |
| description | Compute DGA probabilities using a pre-trained RandomForest model. |
Compute a DGA probability for every normalized DNS query using the model
trained by tools/train_dga_model.py. This skill is used by
dga_classifier_agent in parallel Stage 2.
Primary file-based tool for Pi chain execution:
score_dga_file(
input_path: str,
output_path: str,
model_path: str | Path = MODEL_PATH,
) -> dict
Low-level in-memory helper:
score_dga(
queries: list[dict],
model_path: str | Path = MODEL_PATH,
) -> list[dict]
Implementation: tools/dga_model.py
| Parameter | Type | Required | Description |
|---|---|---|---|
input_path | str | yes | Path to data/output/dns_queries.json |
output_path | str | yes | Path to write the run's dga_scores.json |
model_path | str | no | Path to models/dga_model.pkl |
Each input query should contain:
| Field | Type | Missing value used by features |
|---|---|---|
query_id | integer | required for output |
domain | string | required for output |
domain_length | integer | 0 |
digit_ratio | float | 0.0 |
label_count | integer | 0 |
subdomain | string | "" |
label | string | unknown |
source | string | unknown |
Features are generated in this exact order:
domain_lengthdigit_ratiolabel_countsubdomain_lengthvowel_ratioconsonant_ratiounique_char_ratioSubdomain-derived features match the training logic in
tools/train_dga_model.py.
RandomForestClassifiermodels/dga_model.pklpredict_probapredict_proba(feature_matrix)[:, 1]Returns a dict with processing summary:
| Field | Type | Description |
|---|---|---|
total_processed | integer | Number of valid queries scored |
skipped_count | integer | Malformed query records skipped |
output_file | string | Path where DGA scores were written |
Also writes a JSON array to output_path. Each output row contains:
| Field | Type | Description |
|---|---|---|
query_id | int | Query identifier from Stage 1 |
domain | str | Full DNS domain |
label | str | Ground-truth label if available |
dga_score | float | Malicious-class probability, 0.0-1.0 |
source | str | Data source, such as pcap or csv |
{"error": "file_not_found", ...}{"error": "model_not_found", ...}{"error": "invalid_json", ...}{"error": "invalid_format", ...}skipped_countjoblib
numpy
scikit-learn
from tools.dga_model import score_dga_file
result = score_dga_file(
input_path="data/output/dns_queries.json",
output_path="outputs/<run_timestamp>/dga_scores.json",
model_path="models/dga_model.pkl",
)
print(f"Processed {result['total_processed']} queries")
entropy_agent and embedding_agent.dga_scores.json is merged with entropy and embedding outputs downstream.