{
"info": {
"author": "@Robpol86",
"author_email": "robpol86@gmail.com",
"bugtrack_url": null,
"classifiers": [],
"description": "=======\n libnl\n=======\n\nA port of `libnl `_, a collection of libraries providing APIs to the Netlink\nprotocol based Linux kernel interfaces. This library is API-equivalent to the original C library, and should make it\nrelatively easy to convert C programs into pure Python without having to call external binaries.\n\nAs Netlink is a Linux-specific protocol, this library will only work on Linux hosts. All communication is done using\nsockets between the Python process and the Linux kernel. The main driver for porting libnl was to use\n`nl80211 `_ in Python to scan for wireless access\npoints natively, without having to run an external program and parse its output.\n\n* Python 2.6, 2.7, PyPy, PyPy3, 3.3, and 3.4 supported on Linux\n\n.. |buildWercker| image:: https://img.shields.io/wercker/ci/54f908261d0e8d4b221bfc9d.svg?style=flat-square\n :target: https://app.wercker.com/#applications/54f908261d0e8d4b221bfc9d\n :alt: Build Status WiFi\n\n.. |buildTravis| image:: https://img.shields.io/travis/Robpol86/libnl/master.svg?style=flat-square\n :target: https://travis-ci.org/Robpol86/libnl\n :alt: Build Status\n\n.. |coverage| image:: https://img.shields.io/codecov/c/github/Robpol86/libnl/master.svg?style=flat-square\n :target: https://codecov.io/github/Robpol86/libnl\n :alt: Coverage Status\n\n.. |latestVersion| image:: https://img.shields.io/pypi/v/libnl.svg?style=flat-square\n :target: https://pypi.python.org/pypi/libnl/\n :alt: Latest Version\n\n.. |downloads| image:: https://img.shields.io/pypi/dm/libnl.svg?style=flat-square\n :target: https://pypi.python.org/pypi/libnl/\n :alt: Downloads\n\n============== ================ ============= =============== ===========\nWiFi Linux Coverage Latest Downloads\n============== ================ ============= =============== ===========\n|buildWercker| |buildTravis| |coverage| |latestVersion| |downloads|\n============== ================ ============= =============== ===========\n\n`Quickstart`_\n=============\n\nInstall:\n\n.. code:: bash\n\n pip install libnl\n\n`Example Implementations`_\n==========================\n\nA simple Python program that merely lists network adapters on the host:\n\n.. code:: python\n\n import ctypes\n import socket\n\n from libnl.error import errmsg\n from libnl.handlers import NL_CB_CUSTOM, NL_CB_VALID, NL_OK\n from libnl.linux_private.if_link import IFLA_IFNAME, IFLA_RTA\n from libnl.linux_private.netlink import NETLINK_ROUTE, NLMSG_LENGTH, NLM_F_DUMP, NLM_F_REQUEST\n from libnl.linux_private.rtnetlink import RTA_DATA, RTA_NEXT, RTA_OK, RTM_GETLINK, ifinfomsg, rtgenmsg\n from libnl.misc import get_string\n from libnl.msg import nlmsg_data, nlmsg_hdr\n from libnl.nl import nl_connect, nl_recvmsgs_default, nl_send_simple\n from libnl.socket_ import nl_socket_alloc, nl_socket_modify_cb\n\n\n def callback(msg, _):\n nlh = nlmsg_hdr(msg)\n iface = ifinfomsg(nlmsg_data(nlh))\n hdr = IFLA_RTA(iface)\n remaining = ctypes.c_int(nlh.nlmsg_len - NLMSG_LENGTH(iface.SIZEOF))\n while RTA_OK(hdr, remaining):\n if hdr.rta_type == IFLA_IFNAME:\n print('Found interface {0}: {1}'.format(iface.ifi_index, get_string(RTA_DATA(hdr)).decode('ascii')))\n hdr = RTA_NEXT(hdr, remaining)\n return NL_OK\n\n\n sk = nl_socket_alloc() # Creates an nl_sock instance.\n ret = nl_connect(sk, NETLINK_ROUTE) # Create file descriptor and bind socket.\n if ret < 0:\n raise RuntimeError('nl_connect() returned {0} ({1})'.format(ret, errmsg[abs(ret)]))\n rt_hdr = rtgenmsg(rtgen_family=socket.AF_PACKET)\n ret = nl_send_simple(sk, RTM_GETLINK, NLM_F_REQUEST | NLM_F_DUMP, rt_hdr, rt_hdr.SIZEOF)\n if ret < 0:\n raise RuntimeError('nl_send_simple() returned {0} ({1})'.format(ret, errmsg[abs(ret)]))\n nl_socket_modify_cb(sk, NL_CB_VALID, NL_CB_CUSTOM, callback, None) # Add callback to the nl_sock instance.\n ret = nl_recvmsgs_default(sk) # Get kernel's answer, and call attached callbacks.\n if ret < 0:\n raise RuntimeError('nl_recvmsgs_default() returned {0} ({1})'.format(ret, errmsg[abs(ret)]))\n\nHere are some more examples with their C equivalents in order from \"easy\" to \"hard\":\n\n* `example_list_network_interfaces.py `_ (`list_network_interfaces.c `_)\n* `example_show_wifi_interface.py `_ (`show_wifi_interface.c `_)\n* `example_scan_access_points.py `_ (`scan_access_points.c `_)\n\n`Changelog`_\n============\n\nThis project adheres to `Semantic Versioning `_.\n\n`0.2.0 - 2015-03-26`_\n---------------------\n\nAdded\n * Python2.6, PyPy, and PyPy3 support.\n\n`0.1.1 - 2015-03-15`_\n---------------------\n\n* Initial release.",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/Robpol86/libnl",
"keywords": "netlink libnl libnl-genl nl80211",
"license": "LGPL2.1",
"maintainer": null,
"maintainer_email": null,
"name": "libnl",
"package_url": "https://pypi.org/project/libnl/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/libnl/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/Robpol86/libnl"
},
"release_url": "https://pypi.org/project/libnl/0.2.0/",
"requires_dist": null,
"requires_python": null,
"summary": "Pure Python port of the Netlink protocol library suite.",
"version": "0.2.0"
},
"last_serial": 1479740,
"releases": {
"0.1.1": [
{
"comment_text": "",
"digests": {
"md5": "17b2bf9f717f2fd184810936b034a3c4",
"sha256": "ecb3e2d62be00880089db580c787dfeab5e4fccd4d76bb00957c41624ada3fbe"
},
"downloads": -1,
"filename": "libnl-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "17b2bf9f717f2fd184810936b034a3c4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 62139,
"upload_time": "2015-03-16T03:41:13",
"url": "https://files.pythonhosted.org/packages/da/80/ef28ef4d6313005af2225b2443294c600d69167431d961e74ef005c4f5e9/libnl-0.1.1.tar.gz"
}
],
"0.2.0": [
{
"comment_text": "",
"digests": {
"md5": "7abb80f459dfb63d4bf3eee463b0d222",
"sha256": "4afc211b90dea144c9b9fa18df5a314c729571bc26e7450ef9adf26e15c23f75"
},
"downloads": -1,
"filename": "libnl-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "7abb80f459dfb63d4bf3eee463b0d222",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 63064,
"upload_time": "2015-03-27T06:06:14",
"url": "https://files.pythonhosted.org/packages/03/2b/b1338cb872a0bc608c1406b342cc4f63910d2549af9832118e9e79575c2b/libnl-0.2.0.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "7abb80f459dfb63d4bf3eee463b0d222",
"sha256": "4afc211b90dea144c9b9fa18df5a314c729571bc26e7450ef9adf26e15c23f75"
},
"downloads": -1,
"filename": "libnl-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "7abb80f459dfb63d4bf3eee463b0d222",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 63064,
"upload_time": "2015-03-27T06:06:14",
"url": "https://files.pythonhosted.org/packages/03/2b/b1338cb872a0bc608c1406b342cc4f63910d2549af9832118e9e79575c2b/libnl-0.2.0.tar.gz"
}
]
}