Skip to content

Device watch data layer - #14

Open
ashleigh-byte wants to merge 3 commits into
Role1776:mainfrom
ashleigh-byte:device-watch-data-layer
Open

ashleigh-byte wants to merge 3 commits into
Role1776:mainfrom
ashleigh-byte:device-watch-data-layer

Conversation

@ashleigh-byte

@ashleigh-byte ashleigh-byte commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Second PR in the split of the previous oversized branch (depends on #13 , the device_scans schema migration). Pure data layer — no reporting/AI changes yet.

  • runner.py: extracts MAC, vendor, and hostname from the existing nmap XML scan. nmap only resolves MAC/vendor for hosts on the same local subnet it can ARP directly, which the existing sudo ARP scan already covers — no new scan flags needed.
  • models.py: adds optional mac, vendor, hostname fields to NetworkDevice.
  • sqlite.py: add_devices now persists the new fields; adds get_latest_devices_with_novelty(), which returns the latest scan's devices annotated with whether each MAC was seen in any scan in the last 14 days. Devices with no resolvable MAC are never flagged as new (no reliable identity to compare against).
    Surfacing any of this in the AI report (vendor breakdown, new-devices list) is a separate follow-up PR.

Pure schema change with no consumers yet: nmap-derived MAC address,
vendor, and hostname data will be tracked per device scan starting in
a follow-up PR. Existing databases auto-migrate in place via
_migrate_device_scans_columns() so upgrading doesn't require
recreating the database.
…ty tracking

Builds on the device_scans schema from #<PR1>. Extracts nmap-derived MAC
address, vendor, and hostname per device (nmap only resolves MAC/vendor
for hosts on the same local subnet it can ARP directly, which the
existing sudo ARP scan already covers). Adds get_latest_devices_with_novelty(),
which flags devices whose MAC hasn't been seen in any scan within the
last 14 days -- devices with no resolvable MAC are never flagged as new,
since there's no reliable identity to compare against.

No reporting/AI changes yet -- this is data layer only. Surfacing this
in the AI report is a separate follow-up PR.
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.

2 participants