Skip to content

Add DNS query log parser (dnsmasq / Pi-hole) - #42

Merged
copyleftdev merged 1 commit into
mainfrom
feat/dns
May 31, 2026
Merged

copyleftdev merged 1 commit into
mainfrom
feat/dns

Conversation

@copyleftdev

Copy link
Copy Markdown
Owner

Implements the DNS query log plugin — issue #19.

What

DNS is a favorite covert channel, so beyond extracting the query, DnsParser
computes the features that expose tunnelling:

  • qname_entropy (Shannon entropy of the query name) + qname_length →
    point detection of DGA / exfil names (long, high-entropy);
  • timestamp_epoch → cadence on query timing (beaconing);
  • qtype (e.g. TXT) and client round out each row.

Parses the dnsmasq query line shape <time> dnsmasq[pid]: query[TYPE] NAME from CLIENT; non-query lines (forwarded / reply / cached / config) produce no rows.
The query type must start with an uppercase letter, ruling out prose like
query[0] x from y.

Determinism

The dnsmasq BSD timestamp has no year, so it's parsed with a fixed sentinel year
in UTC — deterministic, never the wall clock (Jan 1 00:00:00 → epoch 0).

Routing

  • Detected by a parseable query line (scanning the first lines, since logs may
    open with non-query lines), STRONG.
  • Claims no extension (DNS logs are generically *.log).

Errors

Input with no query lines is a clean AxError::Parse.

Gates

  • fmt / clippy -D warnings / full workspace tests green (both feature sets).
  • Mutation gate: 0 surviving mutants on dns.rs (entropy, epoch, and
    query-parse logic all covered; the extensions() empty-slice mutant is a
    documented equivalent).
  • Smoke: a query log routes as dns; high-entropy DGA/exfil names are flagged by
    point.modz on qname_entropy/qname_length (exit 1).

Closes #19

🤖 Generated with Claude Code

New DnsParser in ax-normalize. DNS is a favorite covert channel, so beyond
extracting the query we compute the features that expose tunnelling:
qname_length and qname_entropy (Shannon entropy of the query name) feed point
detection of DGA / exfil names (long, high-entropy), and timestamp_epoch feeds
cadence on query timing (beaconing). qtype (e.g. TXT) and client round out each
row.

Parses the dnsmasq query line shape '<time> dnsmasq[pid]: query[TYPE] NAME from
CLIENT'; non-query lines (forwarded/reply/cached/config) produce no rows. The
BSD timestamp has no year, so it is parsed with a fixed sentinel year (UTC) —
deterministic, never the wall clock. The query type must start uppercase, ruling
out prose like 'query[0] x from y'.

Detected by a parseable query line (scanning the first lines, since logs may
open with non-query lines); STRONG; claims no extension (DNS logs are generically
*.log). Input with no query lines is a clean Parse error.

Mutation gate: 0 surviving mutants on the new file. The extensions() ->
empty-slice mutant is a documented equivalent (same as the other signature-only
parsers).

Closes #19

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@copyleftdev, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 42 minutes and 40 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e97d02fc-1abb-4571-b949-69413d95fc3e

📥 Commits

Reviewing files that changed from the base of the PR and between 2c1fc9e and 55f25b2.

📒 Files selected for processing (4)
  • .cargo/mutants.toml
  • crates/ax-normalize/src/parser.rs
  • crates/ax-normalize/src/parsers/dns.rs
  • crates/ax-normalize/src/parsers/mod.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dns

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@copyleftdev
copyleftdev merged commit 86ed0d8 into main May 31, 2026
2 checks passed
@copyleftdev
copyleftdev deleted the feat/dns branch May 31, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a DNS query log parser

1 participant