isc-dhcp-leases
Small python module for reading /var/lib/dhcp/dhcpd.leases from isc-dhcp-server
What it is and what it does
isc-dhcp-leases is a small parser for ISC DHCP server lease database files. It reads the dhcpd.leases file (or dhcpd6.leases for IPv6) and exposes lease records as Python objects with properties like IP address, MAC address, expiration time, binding state, and hostname. You instantiate IscDhcpLeases with a file path, then call get() to retrieve all leases or get_current() to filter only active, non-expired leases.
The package supports both IPv4 (Lease objects) and IPv6 (Lease6 objects) lease formats. It can read plain text or gzip-compressed lease files. Its only runtime dependency is six, making it lightweight. The module is useful for monitoring DHCP server state, auditing active leases, or integrating lease data into network management tools.
Use it for:
- Monitor active DHCP leases on a server to track which devices are currently connected and their IP assignments.
- Audit expired or abandoned leases to understand historical DHCP allocation patterns.
- Integrate lease data into a network management dashboard or monitoring system.
- Query lease information by MAC address to find the IP assigned to a specific device.
- Parse IPv6 lease files to track temporary and delegated prefix assignments in dual-stack networks.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Reads and parses ISC DHCP server lease files (dhcpd.leases) for both IPv4 and IPv6, returning lease data as structured objects with expiration, binding state, and host information.
Yes, if you need to read ISC DHCP lease files on a system running the isc-dhcp-server daemon. The package is stable, has no known vulnerabilities, and installs with minimal friction. However, be aware that maintenance is dormant (last update 1244 days ago); if you encounter issues with modern Python versions or need active support, you may need to fork or patch it yourself.
Install
isc-dhcp-leases on PyPI
pip
pip install isc-dhcp-leasesuv
uv add isc-dhcp-leasespoetry
poetry add isc-dhcp-leasesInstalling isc-dhcp-leases
Before you install
Low friction: pure Python wheel with a single dependency (six). Maintenance is dormant—last release was 1244 days ago—but the package is marked Production/Stable and has no known vulnerabilities, so it is unlikely to require updates for basic use.
License in practice
MIT license is permissive, allowing commercial and private use with minimal restrictions; you may use, modify, and distribute this package freely as long as you retain the license notice.
Quickstart
from isc_dhcp_leases import IscDhcpLeases
leases = IscDhcpLeases('/var/lib/dhcp/dhcpd.leases')
current = leases.get_current() # dict keyed by MAC address
for mac, lease in current.items():
print(f"{mac}: {lease.ip} (expires {lease.end})")
The dhcpd.leases file must be readable by the Python process; typically requires running as root or the dhcp user, or adjusting file permissions on the lease file.
Verify before relying
- Whether the package still works reliably with modern Python 3.x versions beyond 3.5, given the last release was in March 2023.
- Whether gzip-compressed lease file support (mentioned in the description) is fully tested and maintained.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — six |
| Maintenance | dormant — 1,244 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 194,267/month — #9,840 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: isc_dhcp_leases-0.10.0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
ipaddrProvides utilities for parsing, validating, and…
permissive · top 15,000 on PyPI
netaddrRepresents and manipulates IPv4, IPv6, MAC…
permissive · top 5,000 on PyPI
iptoolsProvides utilities for parsing, validating, and…
permissive · top 15,000 on PyPI
IPyIPy provides Python classes for parsing,…
permissive · top 5,000 on PyPI
ipaddressProvides IPv4 and IPv6 address manipulation for…
permissive · top 5,000 on PyPI
cidr-trieStores and queries CIDR IP address blocks (IPv4…
permissive · top 15,000 on PyPI
ipwhoisRetrieves and parses whois and RDAP data for…
permissive · top 15,000 on PyPI
IP2LocationLooks up geolocation data (country, region,…
permissive · top 15,000 on PyPI
ciscoconfparseParses and queries Cisco IOS-style network…
copyleft · top 15,000 on PyPI
py-radixImplements a radix tree data structure for…
permissive · top 15,000 on PyPI