بنقرة واحدة
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.