Skip to main content

dhcpstuff

DHCP Discover sender and response analyzer for network diagnostics: broadcasts a DHCPDISCOVER and prints every answer, including regular DHCP offers and Proxy DHCP responses from PXE boot servers. Standard library only.

Modules

  • dhcp_discover.py — builds a DHCPDISCOVER packet, broadcasts it to 255.255.255.255:67 from UDP port 68 and collects replies for the given timeout. Only replies matching the transaction ID are shown. Each response is labelled DHCP <type> or, if the offered address (yiaddr) is 0.0.0.0, Proxy DHCP <type>, followed by offered IP, next server, server name, boot file and all parsed options with human-readable names. With --arch the Discover carries PXE client architecture (option 93) and a matching PXEClient vendor class (option 60), which Proxy DHCP / PXE boot servers require before they answer.
  • __main__.py — makes python3 -m somestuff.dhcpstuff run the same CLI.

Installation

pip install somestuff-dhcpstuff

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

Usage

Console script and module invocation are equivalent:

sudo dhcp-discover
sudo python3 -m somestuff.dhcpstuff.dhcp_discover
sudo python3 -m somestuff.dhcpstuff
Flag Description
-i, --interface Bind to a specific interface (e.g. eth0)
-t, --timeout Seconds to wait for responses (default: 5)
-m, --mac MAC address to use (default: random locally-administered MAC)
-a, --arch PXE client architecture for option 93: bios, efi64 or efi64-http

Examples:

# Basic discover on all interfaces
sudo dhcp-discover

# Specific interface, PXE EFI64 architecture
sudo dhcp-discover -i eth0 -a efi64

# Custom MAC and longer timeout
sudo dhcp-discover -m 02:aa:bb:cc:dd:ee -t 10

Library

from somestuff.dhcpstuff import build_discover, mac_bytes, parse_response

packet = build_discover(mac_bytes("02:aa:bb:cc:dd:ee"), xid=0x12345678)

The package also exports parse_options, print_response, format_option, fmt_ip, fmt_mac, main and the constants DHCP_SERVER_PORT, DHCP_CLIENT_PORT, MAGIC_COOKIE, DHCP_MSG_TYPES, DHCP_OPTIONS and PXE_ARCH_TYPES.

Privileges

dhcp-discover binds UDP port 68 and needs root (or CAP_NET_BIND_SERVICE). It will not work while another DHCP client holds the port exclusively.

Notes

  • The repository additionally contains diagnose-dhcp.sh, a root-only (German) shell script for finding unwanted DHCP on physical interfaces of Ubuntu Server (cloud-init, Netplan, systemd-networkd, NetworkManager, DHCP client processes, lease files, ip=dhcp kernel cmdline, udev/dispatcher hooks). It is not part of the installed package: https://github.com/vroomfondel/somestuff/tree/main/somestuff/dhcpstuff/
  • Requires: no third-party dependencies. Linux only (SO_BINDTODEVICE).
  • Licensed under the LGPL, see LICENSE.md in the repository root.

Metadata

Release files for somestuff-dhcpstuff 0.1.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-dhcpstuff 0.1.1
File Size Uploaded Provenance Actions
somestuff_dhcpstuff-0.1.1.tar.gz 9.7 kB Without provenance Details for somestuff_dhcpstuff-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for somestuff-dhcpstuff 0.1.1
File Interpreter ABI Platform Actions
somestuff_dhcpstuff-0.1.1-py3-none-any.whl Python 3 none any Details for somestuff_dhcpstuff-0.1.1-py3-none-any.whl

Total release size: 19.5 kB

Release files / somestuff_dhcpstuff-0.1.1.tar.gz

Download URL somestuff_dhcpstuff-0.1.1.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ca56e8d7dbac2e346e082d9d48d5735ba2c7066df17dc33f2d1f69cb002ecc6c
BLAKE2b-256 checksum
How to use checksums
78eaf5bb083564ae2789d61f21cdd0e4afc5ae9ad12ed71ee3b83c8d70fd12cd
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_dhcpstuff-0.1.1-py3-none-any.whl

Download URL somestuff_dhcpstuff-0.1.1-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c678d70d1cd345aee69e964e6d81c41553b7941275ad467472df8500f209697b
BLAKE2b-256 checksum
How to use checksums
e824c232f52d1dc9f88b18698246b68183785c8d12458cf49b2ef749e7b9898e
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-dhcpstuff 0.1.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.1.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