{"id":20995245,"url":"https://github.com/martijnbraam/python-isc-dhcp-leases","last_synced_at":"2025-04-05T14:08:42.318Z","repository":{"id":18201158,"uuid":"21331244","full_name":"MartijnBraam/python-isc-dhcp-leases","owner":"MartijnBraam","description":"Small python module for reading /var/lib/dhcp/dhcpd.leases from isc-dhcp-server","archived":false,"fork":false,"pushed_at":"2024-02-27T00:08:24.000Z","size":80,"stargazers_count":124,"open_issues_count":17,"forks_count":48,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-29T13:11:18.270Z","etag":null,"topics":["dhcp","library","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MartijnBraam.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-06-29T20:07:10.000Z","updated_at":"2025-02-23T04:40:56.000Z","dependencies_parsed_at":"2024-06-18T21:25:28.455Z","dependency_job_id":null,"html_url":"https://github.com/MartijnBraam/python-isc-dhcp-leases","commit_stats":{"total_commits":103,"total_committers":11,"mean_commits":9.363636363636363,"dds":0.3106796116504854,"last_synced_commit":"831b8277e8f2900db2446c3b823b03c7af034fb8"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartijnBraam%2Fpython-isc-dhcp-leases","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartijnBraam%2Fpython-isc-dhcp-leases/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartijnBraam%2Fpython-isc-dhcp-leases/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartijnBraam%2Fpython-isc-dhcp-leases/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MartijnBraam","download_url":"https://codeload.github.com/MartijnBraam/python-isc-dhcp-leases/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345854,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dhcp","library","python"],"created_at":"2024-11-19T07:22:32.324Z","updated_at":"2025-04-05T14:08:42.294Z","avatar_url":"https://github.com/MartijnBraam.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"python-isc-dhcp-leases\n======================\n\n|Build Status| |PyPI version| |Coverage Status|\n\nSmall python module for reading /var/lib/dhcp/dhcpd.leases from\nisc-dhcp-server. This module works in Python 2.7 and 3.x\n\nThis module also supports reading lease files from the isc dhcp daemon\nrunning in IPv6 mode (Since version 0.4.0).\n\nInstallation\n------------\n\nThrough pypi\n~~~~~~~~~~~~\n\n.. code:: bash\n\n    $ sudo pip install isc_dhcp_leases\n\nThrough your distribution package manager\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis python module is currently packaged in Debian unstable (release for Debian 9) and will be packaged in Ubuntu 17.04\n(Zesty Zapus)\n\n.. code:: bash\n\n    # For the python 2.7 interpreter\n    $ sudo apt install python-isc-dhcp-leases\n\n    # For the python 3 interpreter\n    $ sudo apt install python3-isc-dhcp-leases\n\n\nThrough git\n~~~~~~~~~~~\n\n.. code:: bash\n\n    $ git clone git@github.com:MartijnBraam/python-isc-dhcp-leases.git\n    $ cd python-isc-dhcp-leases\n    $ python setup.py build\n    $ sudo python setup.py install\n\nUsage\n-----\n\n.. code:: python\n\n    from isc_dhcp_leases import Lease, IscDhcpLeases\n\n    leases = IscDhcpLeases('/path/to/dhcpd.leases')\n    leases.get()  # Returns the leases as a list of Lease objects\n    leases.get_current()  # Returns only the currently valid dhcp leases as dict\n                          # The key of the dict is the device mac address and the\n                          # Value is a Lease object\n\nOr read a gzip'ed file:\n\n.. code:: python\n\n    from isc_dhcp_leases import Lease, IscDhcpLeases\n    # IscDhcpLeases(filename, gzip=False)\n    leases = IscDhcpLeases('/path/to/dhcpd.leases', True) # True param starts the gzip reader\n    leases.get()  # Returns the leases as a list of Lease objects\n    leases.get_current()  # Returns only the currently valid dhcp leases as dict\n                          # The key of the dict is the device mac address and the\n                          # Value is a Lease object\n\nThe Lease object has the following fields (only for IPv4 leases):\n\n.. code:: python\n\n    lease instanceof Lease\n    lease.ip             # The ip address assigned by this lease as string\n    lease.ethernet       # The mac address of the lease\n    lease.hardware       # The OSI physical layer used to request the lease (usually ethernet)\n    lease.start          # The start time of this lease as DateTime object\n    lease.end            # The time this lease expires as DateTime object or None if this is an infinite lease\n    lease.hostname       # The hostname for this lease if given by the client\n    lease.binding_state  # The binding state as string ('active', 'free', 'abandoned', 'backup')\n    lease.data           # Dict of all the info in the dhcpd.leases file for this lease\n    lease.valid          # True if the lease hasn't expired and is not in the future\n    lease.active         # True if the binding state is active\n    lease.options        # List of extra options in the lease file\n    lease.sets           # List of the 'set' items in the lease file\n\n\nThe Lease6 object has the following fields (only for IPv6):\n\n.. code:: python\n\n    lease instanceof Lease6\n    lease.ip                 # The ip address assigned by this lease as string\n    lease.type               # If this is a temporary or permanent address. I's one of the following:\n                             # Lease6.TEMPORARY: Temporary lease\n                             # Lease6.NON_TEMPORARY: Non-temporary lease\n                             # Lease6.PREFIX_DELEGATION: Delegated prefix lease\n    lease.host_identifier    # The unique host identifier (replaces mac addresses in IPv6) as bytes\n    lease.host_identifier_string # The host_identifier property formatted as an hexadecimal string\n    lease.duid               # The DHCP Unique Identifier (DUID) of the host as bytes\n    lease.iaid               # The Interface Association Identifier (IAID) of the host\n    lease.last_communication # The last communication time with the host\n    lease.end                # The time this lease expires as DateTime object or None if this is an infinite lease\n    lease.binding_state      # The binding state as string ('active', 'free', 'abandoned', 'backup')\n    lease.preferred_life     # The preferred lifetime in seconds\n    lease.max_life           # The valid lifetime for this address in seconds\n    lease.options            # List of extra options in the lease file\n    lease.sets               # List of the 'set' items in the lease file\n    lease.data               # Dict of all the info in the dhcpd6.leases file for this lease\n\nUnit tests\n----------\n\nThe unit tests can be run with ``setup.py``:\n\n.. code:: bash\n\n    $ python3 setup.py test\n    # With coverage report:\n    $ coverage run setup.py test\n\n.. |Build Status| image:: https://travis-ci.org/MartijnBraam/python-isc-dhcp-leases.svg?branch=master\n   :target: https://travis-ci.org/MartijnBraam/python-isc-dhcp-leases\n.. |PyPI version| image:: https://badge.fury.io/py/isc_dhcp_leases.svg\n   :target: http://badge.fury.io/py/isc_dhcp_leases\n.. |Coverage Status| image:: https://coveralls.io/repos/MartijnBraam/python-isc-dhcp-leases/badge.svg\n   :target: https://coveralls.io/r/MartijnBraam/python-isc-dhcp-leases\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartijnbraam%2Fpython-isc-dhcp-leases","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartijnbraam%2Fpython-isc-dhcp-leases","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartijnbraam%2Fpython-isc-dhcp-leases/lists"}