skillfed

isc-dhcp-leases

Small python module for reading /var/lib/dhcp/dhcpd.leases from isc-dhcp-server

isc-dhcp-leases v0.10.0 194.3K downloads/30d#9,840 on PyPI129
Permissive license MIT DORMANT released

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-leases

uv

uv add isc-dhcp-leases

poetry

poetry add isc-dhcp-leases

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Topic :: Software Development

Tags

dhcp lease file parserisc dhcp leases readerdhcpd.leases pythondhcp lease expiration checkipv4 ipv6 dhcp parser
dhcpnetwork-adminlease-parser

More Software Development packages