{ "info": { "author": "Jay Mehta", "author_email": "jay87.mehta@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: GNU Affero General Public License v3", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "==============\npydhcpdparser\n==============\n\n**pydhcpdparser** is a pure python based, DHCPD configuration parser.\nBuilt using **ply**, lex and yacc parsing tool, pydhcpdparser can be used\nto verify syntax of DHCPD configurations, parse and extract values from\nconfiguration files and access them as python variables.\n\nExamples\n---------\nIf you input DHCPD configuration to pydhcpdparser as\n\n::\n\n subnet 10.198.146.0 netmask 255.255.255.192 {\n pool {\n failover peer \"az-dhcp-failover\";\n range 10.198.146.4 10.198.146.62;\n }\n option routers 10.198.146.1;\n option broadcast-address 10.198.146.63;\n option domain-name \"some.domain.net\";\n option domain-name-servers 10.24.199.136,10.24.199.137;\n }\n\n**pydhcpdparser** verifies DHCPD syntax, parse and return back\npythonic result as\n\n::\n\n [{'netmask': '255.255.255.192',\n 'option': {'broadcast-address': '10.198.146.63',\n 'domain-name': '\"some.domain.net\"',\n 'domain-name-servers': '10.24.199.136,10.24.199.137',\n 'routers': '10.198.146.1'},\n 'pool': {'failover': ('peer', '\"az-dhcp-failover\"'),\n 'range': ('10.198.146.4', '10.198.146.62')},\n 'subnet': '10.198.146.0'}]\n\n\nUsage\n-----\n\n.. code:: python\n\n import pydhcpdparser\n\n conf = \"\"\"\n subnet 10.198.146.0 netmask 255.255.255.192 {\n pool {\n failover peer \"az-dhcp-failover\";\n range 10.198.146.4 10.198.146.62;\n }\n option routers 10.198.146.1;\n option broadcast-address 10.198.146.63;\n option domain-name \"some.domain.net\";\n option domain-name-servers 10.24.199.136,10.24.199.137;\n }\n \"\"\"\n print(pydhcpdparser.parser.parse(conf))\n\n\nOR\n\n.. code:: python\n\n from pydhcpdparser import parser\n\n conf = \"zone 17.127.10.in-addr.arpa. { key DHCPUPDATE; }\"\n print(parser.parse(conf))\n\n\nOR\n\n.. code:: python\n\n from pydhcpdparser import *\n\n with open(\"/etc/dhcp/dhcpd.conf\") as f:\n conf = f.read()\n print(parser.parse(conf))\n\n\nInstalling **pydhcpdparser**\n----------------------------\n\n.. code:: bash\n\n $ pip install pydhcpdparser\n\n\nDevelopment installation **pydhcpdparser**\n-------------------------------------------\n\n.. code:: bash\n\n $ pip install pydhcpdparser -r test-requirements.txt\n\n\nSupported configuration parser\n------------------------------\n\n1. Subnet statements\n\n ::\n\n subnet subnet-number netmask netmask {\n [ parameters ]\n [ declarations ]\n }\n\n2. pool declaration\n\n3. range statement\n ::\n\n range [ dynamic-bootp ] low-address [ high-address];\n\n4. Option statements\n ::\n\n option name value1[, value2...];\n\n5. Zone declaration\n\n6. Key declaration\n ::\n\n key name {\n algorithm algo;\n secret value;\n };\n\n7. Include statement\n ::\n\n include \"filename\";\n\n8. Allow and Deny declarations within pool declarations\n ::\n\n known-clients;\n unknown-clients;\n dynamic bootp clients;\n authenticated clients;\n unauthenticated clients;\n all clients;\n after time;\n members of \"class\";\n\n9. Allow, Deny and Ignore declarations at global scope\n ::\n\n unknown-clients\n bootp\n duplicates\n client-updates\n leasequery\n booting\n declines\n\n10. Global parameters declaration statement\n\n ::\n\n adandon-lease-time time;\n adaptive-lease-time-threshold percentage;\n always-broadcast flag;\n always-reply-rfc1048 flag;\n authoritative;\n not authoritative;\n boot-unknown-clients flag;\n db-time-format [ default | local ] ;\n ddns-domainname name;\n ddns-rev-domainname name;\n ddns-update-style style;\n ddns-updates flag;\n default-lease-time time;\n delayed-ack count;\n max-ack-delay microseconds;\n do-forward-updates flag;\n dynamic-bootp-lease-cutoff date;\n dynamic-bootp-lease-length length;\n filename \"filename\";\n get-lease-hostnames flag;\n infinite-is-reserved flag;\n lease-file-name name;\n limit-addrs-per-ia number;\n dhcpv6-lease-file-name name;\n local-port port;\n local-address address;\n log-facility facility;\n max-lease-time time;\n min-lease-time time;\n min-secs seconds;\n next-server server-name;\n omapi-port port;\n one-lease-per-client flag;\n pid-file-name name;\n dhcpv6-pid-file-name name;\n ping-check flag;\n ping-timeout seconds;\n preferred-lifetime seconds;\n remote-port port;\n server-identifier hostname;\n server-duid LLT [ hardware-type timestamp hardware-address ] ;\n server-duid EN enterprise-number enterprise-identifier ;\n server-duid LL [ hardware-type hardware-address ] ;\n server-name name ;\n dhcpv6-set-tee-times flag;\n site-option-space name ;\n stash-agent-options flag;\n update-conflict-detection flag;\n update-optimization flag;\n update-static-leases flag;\n use-host-decl-names flag;\n use-lease-addr-for-default-route flag;\n vendor-option-space string;\n\n\n11. Host block declaration statements\n\n ::\n\n always-reply-rfc1048 flag;\n ddns-hostname name;\n ddns-domainname name;\n fixed-address address [, address ... ];\n fixed-address6 ip6-address ;\n fixed-prefix6 low-address / bits;\n hardware hardware-type hardware-address;\n\n\nUnit testing\n-------------\n\n.. code:: bash\n\n $ python -m unittest discover\n\n.. code:: bash\n\n $ python3 -m uninttest", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jay-g-mehta/pydhcpdparser", "keywords": "DHCP DHCPD configuration parser", "license": "", "maintainer": "", "maintainer_email": "", "name": "pydhcpdparser", "package_url": "https://pypi.org/project/pydhcpdparser/", "platform": "", "project_url": "https://pypi.org/project/pydhcpdparser/", "project_urls": { "Homepage": "https://github.com/jay-g-mehta/pydhcpdparser" }, "release_url": "https://pypi.org/project/pydhcpdparser/0.0.9/", "requires_dist": null, "requires_python": "", "summary": "DHCP configuration file parser", "version": "0.0.9" }, "last_serial": 4892150, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "f6b57b83781b02ab399feb82783d4014", "sha256": "50bad0a798c35da54af41c04b0dce22663ef9843736ac44116b8bb7d3163013e" }, "downloads": -1, "filename": "pydhcpdparser-0.0.2.tar.gz", "has_sig": false, "md5_digest": "f6b57b83781b02ab399feb82783d4014", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4093, "upload_time": "2018-05-17T20:49:09", "url": "https://files.pythonhosted.org/packages/cb/6d/791edef8190c0e5825c5b3e896ec5ca90e83eca8a9eac2a9c26cdaa06d14/pydhcpdparser-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "939bc1175886ac169fc31e0239b5739a", "sha256": "8bea13ce81600e219fe156a073d24488e477d9bd542cecb20ae34b13340a453b" }, "downloads": -1, "filename": "pydhcpdparser-0.0.3.tar.gz", "has_sig": false, "md5_digest": "939bc1175886ac169fc31e0239b5739a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4147, "upload_time": "2018-05-18T18:49:17", "url": "https://files.pythonhosted.org/packages/4c/2d/02f4e705a46fc0c9381a94aa4de600bffe340c3ca82c1d7f191e60a2b35e/pydhcpdparser-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "665ade58464239f5f73c321ea644868e", "sha256": "296926949530f95d65b1dec4c10d674b2ee3c369529b163c3c6ad991e6e73e82" }, "downloads": -1, "filename": "pydhcpdparser-0.0.4.tar.gz", "has_sig": false, "md5_digest": "665ade58464239f5f73c321ea644868e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6904, "upload_time": "2018-05-22T18:40:46", "url": "https://files.pythonhosted.org/packages/bd/a4/b33a30740ce74f621702fc38b7c88a0ae9777a553e2231a962b9fda38519/pydhcpdparser-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "cc66d0508ac07c973eca7e37efdc6df7", "sha256": "c88d04f53a1decd1b91d4ed7e73e61aacf00a5b9a506d66a78699f8cadb9e914" }, "downloads": -1, "filename": "pydhcpdparser-0.0.5.tar.gz", "has_sig": false, "md5_digest": "cc66d0508ac07c973eca7e37efdc6df7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13139, "upload_time": "2018-05-30T04:06:55", "url": "https://files.pythonhosted.org/packages/71/79/a1cec9db24da1a5844a87f461d99de16644fe62a521ff921a9f0ff9c9f36/pydhcpdparser-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "86545d1353b7371231f52c7b7249cf71", "sha256": "481c1202fa300d58071729e96d7515989486832847ab7d1d2bd4547a2dc66dd8" }, "downloads": -1, "filename": "pydhcpdparser-0.0.6.tar.gz", "has_sig": false, "md5_digest": "86545d1353b7371231f52c7b7249cf71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13203, "upload_time": "2018-05-30T19:17:26", "url": "https://files.pythonhosted.org/packages/a0/66/f874545aa53499df4afe0a01875ff281fe8c44422d034c0649974c1f0ee0/pydhcpdparser-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "b91e451697077f6bbd9f3ad89fae2b8b", "sha256": "0699be6b3552d4af501f0bc21c5f984296cb8aa1343e55b8a0cf6a92cc971532" }, "downloads": -1, "filename": "pydhcpdparser-0.0.7.tar.gz", "has_sig": false, "md5_digest": "b91e451697077f6bbd9f3ad89fae2b8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13247, "upload_time": "2018-05-30T20:19:32", "url": "https://files.pythonhosted.org/packages/b9/98/c689ab2ae52790cc403bafda3b12b37ae1ba3543ed72e78b321f72fd189d/pydhcpdparser-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "c961aac6d4c36ed7d6ee11fc999180b7", "sha256": "c8e381dc7a6a0d8fda44d2bc7f855c62b5a6c9399267ff0d30d6a911d9b7d4c7" }, "downloads": -1, "filename": "pydhcpdparser-0.0.8.tar.gz", "has_sig": false, "md5_digest": "c961aac6d4c36ed7d6ee11fc999180b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13289, "upload_time": "2018-05-30T21:49:28", "url": "https://files.pythonhosted.org/packages/ca/c3/01fd6ef2d4f0cb5e999ab3adbd52d3b6d161ecceedfc499a665d8e8e1516/pydhcpdparser-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "fb1ff408436865d4db29e0507b1e3ff4", "sha256": "a3ce497044b4f9571f1e7fc3f819815474f30819ed47a62fce571cbb83e41750" }, "downloads": -1, "filename": "pydhcpdparser-0.0.9.tar.gz", "has_sig": false, "md5_digest": "fb1ff408436865d4db29e0507b1e3ff4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13367, "upload_time": "2019-03-03T23:29:06", "url": "https://files.pythonhosted.org/packages/f1/d1/0f65d8a24fea442e0b749a25f77b4038f4ab316ac70a0b21c821514d6a3c/pydhcpdparser-0.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fb1ff408436865d4db29e0507b1e3ff4", "sha256": "a3ce497044b4f9571f1e7fc3f819815474f30819ed47a62fce571cbb83e41750" }, "downloads": -1, "filename": "pydhcpdparser-0.0.9.tar.gz", "has_sig": false, "md5_digest": "fb1ff408436865d4db29e0507b1e3ff4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13367, "upload_time": "2019-03-03T23:29:06", "url": "https://files.pythonhosted.org/packages/f1/d1/0f65d8a24fea442e0b749a25f77b4038f4ab316ac70a0b21c821514d6a3c/pydhcpdparser-0.0.9.tar.gz" } ] }