{ "info": { "author": "Michael Walle", "author_email": "michael@walle.cc", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Networking" ], "description": "raw sockets made easy\n=====================\n\nOnly in linux, sorry.\n\n\nRationale\n---------\n\nIf you need raw sockets in your python script, you have to run it as root\nor make it SUID root. Alternatively, you can use file capabilities to grant\nextended priviliges to a binary. Unfortunately, this only works on binaries\nand not on scripts, which means you have to set the capability on the\npython binary.\n\n\nHow does it work?\n-----------------\n\nAs mentioned above, you can only set capabilties on a binary. Therefore,\nthis module has a helper binary, which will get the RAW_NET capability.\nThis binary is spawned by the rawsocket python module every time you create\na new raw socket. The helper uses its capability to create the socket and\nthen passes the file descriptor back to the calling program.\n\nIn linux you can pass file descriptors through unix domain sockets by using\nthe ``sendmsg()`` system call and ``SCM_RIGHTS``. See also `fd passing`_.\n\n\nInstallation\n------------\n\nUse PIP::\n\n pip install rawsocket\n\nOr use the standard method::\n\n python setup.py install\n\nThis will install the extension module and the helper binary. But it will\n*not* set the file capability on the helper binary. You have two choices:\n\n1. Grant every user access to the helper (simple, *not recommended*)::\n\n setcap cap_net_raw+ep rawsocket-helper\n\n2. Grant access only to users which are member of a specific group\n (recommended)::\n\n chmod 750 rawsocket-helper\n chown root:yourgroup rawsocket-helper\n setcap cap_net_raw+ep rawsocket-helper\n\n\nExample\n-------\n\n.. code:: python\n\n import socket, rawsocket\n fd = rawsocket.rawsocket_fd()\n s = socket.fromfd(fd, socket.AF_PACKET, socket.SOCK_RAW)\n\nYou see easy as pie ;)\n\n\nLicense\n-------\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice,\nthis list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n\n.. _fd passing: http://keithp.com/blogs/fd-passing/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/mwalle/rawsocket", "keywords": null, "license": "New BSD", "maintainer": null, "maintainer_email": null, "name": "rawsocket", "package_url": "https://pypi.org/project/rawsocket/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rawsocket/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/mwalle/rawsocket" }, "release_url": "https://pypi.org/project/rawsocket/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "Raw packet socket for Linux", "version": "0.1.2" }, "last_serial": 1627632, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "7a1062f282225eefeb8dc6839c2bbe96", "sha256": "c6e9ffaa96c3b0a03bf91efa31aa12206991908b4585d5a39730d7eb72717edb" }, "downloads": -1, "filename": "rawsocket-0.1.2.tar.gz", "has_sig": false, "md5_digest": "7a1062f282225eefeb8dc6839c2bbe96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5535, "upload_time": "2015-07-10T11:35:51", "url": "https://files.pythonhosted.org/packages/b3/2b/d3d61b54f769ddc099efe2f0ee9d5ed63bcdef092d9e9f529924996ab7e0/rawsocket-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7a1062f282225eefeb8dc6839c2bbe96", "sha256": "c6e9ffaa96c3b0a03bf91efa31aa12206991908b4585d5a39730d7eb72717edb" }, "downloads": -1, "filename": "rawsocket-0.1.2.tar.gz", "has_sig": false, "md5_digest": "7a1062f282225eefeb8dc6839c2bbe96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5535, "upload_time": "2015-07-10T11:35:51", "url": "https://files.pythonhosted.org/packages/b3/2b/d3d61b54f769ddc099efe2f0ee9d5ed63bcdef092d9e9f529924996ab7e0/rawsocket-0.1.2.tar.gz" } ] }