{ "info": { "author": "Walter Doekes, OSSO B.V.", "author_email": "wjdoekes+pylresolv@osso.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Internet :: Name Service (DNS)", "Topic :: Software Development :: Libraries" ], "description": "pylresolv - DNS querying through libc libresolv.so using ctypes\n===============================================================\n\nProvides access to ``res_query`` (``resolver(3)``) and friends for very\nbasic DNS querying (beyond ``gethostbyname``).\n\n*Right now, it only supports MX record lookups.*\n\nThis is *not* a replacement for fully featured DNS libraries like\n``dnspython`` or ``pycares``, but rather a small wrapper to provide a bare\nminimal lookup capability. Additionally, it serves as an example of how\nto use ``-lresolv`` routines.\n\n.. warning:: BEWARE!\n\n This library uses (a) not-so-well documented C library calls which\n (b) may differ in their ABI across different libc versions and\n operating systems. Proceed with caution. The only thing this has\n going for it, is its small size.\n\n\nMost common usage\n-----------------\n\n.. code-block:: python\n\n from pylresolv import ns_parse, ns_type, res_query\n\n answer = res_query('gmail.com', rr_type=ns_type.ns_t_mx)\n ret = ns_parse(answer, handler=ns_type.handle_t_mx)\n print(ret)\n\nWill produce a list of ``RR`` objects::\n\n [RR((40, u'alt4.gmail-smtp-in.l.google.com')),\n RR((30, u'alt3.gmail-smtp-in.l.google.com')),\n RR((10, u'alt1.gmail-smtp-in.l.google.com')),\n RR((20, u'alt2.gmail-smtp-in.l.google.com')),\n RR((5, u'gmail-smtp-in.l.google.com'))]\n\nExample from main:\n\n.. code-block:: python\n\n from pprint import pprint\n queries = (\n ('gmail.com', ns_type.ns_t_ns),\n ('gmail.com', ns_type.ns_t_a),\n ('gmail.com', ns_type.ns_t_mx),\n ('gmail.com', ns_type.ns_t_txt),\n ('www.gmail.com', ns_type.ns_t_cname),\n )\n for qhost, qtype in queries:\n print('Querying host {!r} type {!r}:'.format(qhost, qtype))\n answer = res_query(qhost, rr_type=qtype)\n ret = ns_parse(answer)\n # ret = ns_parse(answer, handler=ns_type.handle_t_mx)\n # ret = ns_parse(answer, handler=ns_type.handle_bin)\n pprint([rr.contents for rr in ret])\n print()\n\nProduces::\n\n Querying host 'gmail.com' type :\n ['ns2.google.com', 'ns4.google.com', 'ns3.google.com', 'ns1.google.com']\n\n Querying host 'gmail.com' type :\n [bytearray(b'\\xac\\xd9\\x11e')]\n\n Querying host 'gmail.com' type :\n [(40, 'alt4.gmail-smtp-in.l.google.com'),\n (30, 'alt3.gmail-smtp-in.l.google.com'),\n (10, 'alt1.gmail-smtp-in.l.google.com'),\n (20, 'alt2.gmail-smtp-in.l.google.com'),\n (5, 'gmail-smtp-in.l.google.com')]\n\n Querying host 'gmail.com' type :\n ['globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8=',\n 'v=spf1 redirect=_spf.google.com']\n\n Querying host 'www.gmail.com' type :\n ['mail.google.com']\n\n\n2019-07-03: 0.2\n~~~~~~~~~~~~~~~\n\n- Renamed ``ns_type.handle_mx`` to ``ns_type.handle_t_mx``.\n- Added:\n - ``handle_bin``\n - ``handle_compressed``\n - ``handle_text``\n - ``handle_t_cname``\n - ``handle_t_ns```\n - ``handle_t_txt```\n- ``ns_parse`` now wraps the returned values into ``RR`` objects, so the\n type can be retrieved afterwards. The value can be fetched from its\n ``contents`` property.\n- You can use ``handle_bin`` to fetch A or AAAA records.\n- ``res_query`` now raises LookupError on failure.\n\n\n2019-03-17: 0.1\n~~~~~~~~~~~~~~~\n\n- Initial release.\n\n\nCopyright\n---------\n\nCopyright 2019, Walter Doekes (OSSO B.V.)\n\nThis program is free software: you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation, either version 3 of the License, or (at your\noption) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\nPublic License for more details.\n\nYou should have received a copy of the GNU General Public License along\nwith this program. If not, see http://www.gnu.org/licenses/.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ossobv/pylresolv", "keywords": "", "license": "GPLv3+", "maintainer": "", "maintainer_email": "", "name": "pylresolv", "package_url": "https://pypi.org/project/pylresolv/", "platform": "", "project_url": "https://pypi.org/project/pylresolv/", "project_urls": { "Homepage": "https://github.com/ossobv/pylresolv" }, "release_url": "https://pypi.org/project/pylresolv/0.2/", "requires_dist": null, "requires_python": "", "summary": "DNS querying through libc libresolv.so using ctypes", "version": "0.2" }, "last_serial": 5480641, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "d78e3617aadeab9216117065ec849834", "sha256": "5b3155573ed8aa614886b9a2d3892e7d6c300a3f0cd7939b2f192d5b55c7df23" }, "downloads": -1, "filename": "pylresolv-0.1.tar.gz", "has_sig": false, "md5_digest": "d78e3617aadeab9216117065ec849834", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4822, "upload_time": "2019-03-17T21:39:34", "url": "https://files.pythonhosted.org/packages/b4/09/a95f3f84a86f993d364060bb62d6ac29d01fb8fdf9259bd12a43eb8575a4/pylresolv-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "79ec3ecdeeaeca297ddb63270caae1e4", "sha256": "f8c848ece69ab7919e3ccc0828f604dcbcaf4b34e448b167f2143faeee9ffa18" }, "downloads": -1, "filename": "pylresolv-0.2.tar.gz", "has_sig": false, "md5_digest": "79ec3ecdeeaeca297ddb63270caae1e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6197, "upload_time": "2019-07-03T10:32:22", "url": "https://files.pythonhosted.org/packages/17/40/8038ef36e05504778c4adab14f561325dd81e5aab92a0dc7cac398d10ec4/pylresolv-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "79ec3ecdeeaeca297ddb63270caae1e4", "sha256": "f8c848ece69ab7919e3ccc0828f604dcbcaf4b34e448b167f2143faeee9ffa18" }, "downloads": -1, "filename": "pylresolv-0.2.tar.gz", "has_sig": false, "md5_digest": "79ec3ecdeeaeca297ddb63270caae1e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6197, "upload_time": "2019-07-03T10:32:22", "url": "https://files.pythonhosted.org/packages/17/40/8038ef36e05504778c4adab14f561325dd81e5aab92a0dc7cac398d10ec4/pylresolv-0.2.tar.gz" } ] }