Skip to main content

dnsstuff

DNS and network diagnostics for mail relays and LANs: an SPF crawler that feeds a Linux ipset, a Microsoft 365 21Vianet IP-range updater, and an mDNS resolver that shows which host actually answered.

Modules

  • spf_ipset_updater.py — recursively resolves the SPF records of the given domains (include:, a, mx, ip4, redirects), collects every IPv4 address and network and atomically swaps the result into a kernel ipset via netlink (pyroute2). Meant for SMTP allowlists on relay hosts.
  • update_21vianet_ips.py — polls the Microsoft 365 endpoint API for the 21Vianet (China) Exchange Online ranges, caches the version and updates two ipsets: all Exchange IPv4 networks and the SMTP-only (port 25) subset.
  • mdns_who.py — sends an mDNS query for a .local name itself and reports every responder: source IP, advertised A records, TTL and cache-flush bit. Flags proxied, cached or reflected replies (source IP ≠ advertised IP, more than one responder). --unicast adds a system-resolver lookup to surface a stale router DHCP lease.

Logging (loguru, with an intercept for stdlib logging from dnspython, pyroute2, urllib) and the startup banner are shared via somestuff.dnsstuff.

Installation

pip install somestuff-dnsstuff

somestuff is a PEP 420 namespace; the package is imported as somestuff.dnsstuff and shares the namespace with the other somestuff-* distributions.

Usage

Console scripts and module invocation are equivalent:

spf-ipset-updater example.com mail.example.net --ipset-name smtpallowlist
python3 -m somestuff.dnsstuff.spf_ipset_updater example.com --dry-run -v

update-21vianet-ips --ipset-name-all 21vianet_exchange --ipset-name-smtp 21vianet_smtp
python3 -m somestuff.dnsstuff.update_21vianet_ips --force --dry-run

mdns-who printer.local
python3 -m somestuff.dnsstuff.mdns_who printer --timeout 3 --unicast --iface 192.0.2.5

Common flags: --dry-run populates the ipset but skips the atomic swap, --no-comment disables the ipset comment extension, -v enables DEBUG logging. update-21vianet-ips --help lists the cache directory and API timeout options.

Cron example for the 21Vianet updater (daily at 03:00):

0 3 * * * update-21vianet-ips 2>&1 | logger -t 21vianet

Library

from somestuff.dnsstuff import configure_logging
from somestuff.dnsstuff.spf_ipset_updater import get_spf_records

configure_logging(verbose=True)

Privileges

  • spf-ipset-updater and update-21vianet-ips modify kernel ipsets over netlink and need CAP_NET_ADMIN (in practice: root).
  • mdns-who binds a UDP socket on port 5353 and joins the mDNS multicast group; on most systems this works unprivileged unless another mDNS daemon holds the port exclusively.

Notes

  • Requires: dnspython, pyroute2, loguru, tabulate. Linux only (netlink ipsets).
  • Licensed under the LGPL, see LICENSE.md in the repository root.

Metadata

Release files for somestuff-dnsstuff 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for somestuff-dnsstuff 0.2.1
File Size Uploaded Provenance Actions
somestuff_dnsstuff-0.2.1.tar.gz 23.7 kB Without provenance Details for somestuff_dnsstuff-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for somestuff-dnsstuff 0.2.1
File Interpreter ABI Platform Actions
somestuff_dnsstuff-0.2.1-py3-none-any.whl Python 3 none any Details for somestuff_dnsstuff-0.2.1-py3-none-any.whl

Total release size: 50.1 kB

Release files / somestuff_dnsstuff-0.2.1.tar.gz

Download URL somestuff_dnsstuff-0.2.1.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
998204ec25b48adde4c2f127ec6202502298596f4a998a8e2f74f9adf00f6445
BLAKE2b-256 checksum
How to use checksums
3007c907446f0fdbca71d5f2e9d51f32861d402bc4ce08716070771aed586351
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.2 {"ci":null,"cpu":"x86_64","distro":{"id":"resolute","libc":{"lib":"glibc","version":"2.43"},"name":"Ubuntu","version":"26.04"},"implementation":{"name":"CPython","version":"3.14.4"},"installer":{"name":"hatch","version":"1.18.2"},"openssl_version":"OpenSSL 3.5.5 27 Jan 2026","python":"3.14.4","system":{"name":"Linux","release":"7.2.10-custom"}} HTTPX2/2.16.0

Release files / somestuff_dnsstuff-0.2.1-py3-none-any.whl

Download URL somestuff_dnsstuff-0.2.1-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87b7fdaef5be58b34e799c6b88560c27972d237400c28520741d21d0a06a6990
BLAKE2b-256 checksum
How to use checksums
506a52b5da1f4f5a7ea17943120af6595dba2597159adde9823d567b4cb51de0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.2 {"ci":null,"cpu":"x86_64","distro":{"id":"resolute","libc":{"lib":"glibc","version":"2.43"},"name":"Ubuntu","version":"26.04"},"implementation":{"name":"CPython","version":"3.14.4"},"installer":{"name":"hatch","version":"1.18.2"},"openssl_version":"OpenSSL 3.5.5 27 Jan 2026","python":"3.14.4","system":{"name":"Linux","release":"7.2.10-custom"}} HTTPX2/2.16.0

Security for somestuff-dnsstuff 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page