Project 03 · Rust · In progress

netwatch

A network analyzer in Rust. It starts small: look at DNS queries, and point at the ones going to trackers.

Right now it’s a struct, two methods and four hard-coded queries. The packet capture comes later.

How it works ↓

describe() + flagged_as_tracker()4 sample queries

  • 24.2.0.1www.example.com[Allowed] (71727287848484351)
  • 242.8.0.1www.test.com[Allowed] (9394758383854412)
  • 44.42.41.24ads.google.com[Blocked] (9394371943949)Flagged
  • 12.1.11.12telemetry.cloudflare.com[Blocked] (93894174839394)Flagged

Total blocked: 2

The four queries hard-coded in main.rs, in the format describe() prints.

How it works

One struct holds a query. One method prints it, one decides if it looks like a tracker.

src/main.rsrust
struct DnsQuery {
    domain: String,
    client_ip: String,
    timestamp: u64,
    blocked: bool,
}

impl DnsQuery {
    fn flagged_as_tracker(&self) -> bool {
        ["ads", "telemetry", "tracker"]
            .iter()
            .any(|k| self.domain.contains(k))
    }
}

Trimmed: describe() and the sample data are left out.

One domain, three keywords

telemetry.cloudflare.com

  • "ads"false
  • "telemetry"contains → true
  • "tracker"false

flagged_as_tracker() → trueany() stops at the first match

Simple and easy to fool: “badstuff.com” matches “ads”, and a tracker called “metrics” gets through. That’s what the blocklist is for.

Roadmap

  1. Model a query

    A struct, a describe(), a tracker check.

    done
  2. Read real packets

    Listen on UDP port 53 and parse the DNS header and question.

    next
  3. Blocklists

    Swap the three keywords for a real list of tracker domains.

    planned
  4. Per-device view

    Group queries by client so you can see which device is the chatty one.

    planned
  5. Live in the terminal

    A small TUI that scrolls as queries come in.

    planned

Jump to

↑ ↓ move↵ openesc close

You found the 8.

mi8ess can read this board but cannot generate moves yet, so both sides are moved by hand.

Play e4 to start

Open mi8ess

Click anywhere to close