{ "info": { "author": "JanKinCai", "author_email": "jankincai12@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation", "Topic :: Software Development :: Libraries" ], "description": "==============\npython-libpcap\n==============\n\n.. image:: https://img.shields.io/pypi/v/python-libpcap.svg\n :target: https://pypi.python.org/pypi/python-libpcap\n\n.. image:: https://api.travis-ci.com/caizhengxin/python-libpcap.svg\n :target: https://travis-ci.org/JanKinCai/python-libpcap\n\n.. image:: https://readthedocs.org/projects/python-libpcap/badge/?version=latest\n :target: https://python-libpcap.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\nCython libpcap\n\n* Documentation: https://python-libpcap.readthedocs.io\n\nFeatures\n--------\n\n* Read pcap file\n* Write pcap file\n* Merge pcap file\n* Get first iface\n* Capture data\n\nInstallation\n------------\n\nTo install python-libpcap, run this command in your terminal:\n\n.. code-block:: console\n\n $ sudo apt-get install libpcap-dev\n $ pip3 install Cython\n $ pip3 install python-libpcap\n\nDemo\n----\n\nConsole:\n\n.. code-block:: console\n\n $ mpcap -i pcap/ -o pcap.pcap port 502\n $ sudo capture -i enp2s0 -v\n\nRead pcap:\n\n.. code-block:: python\n\n from pylibpcap.pcap import rpcap\n\n\n for len, t, pkt in rpcap(\"tests/dns.pcap\"):\n print(\"Buf length:\", len)\n print(\"Time:\", t)\n print(\"Buf:\", pkt)\n\nWrite pcap:\n\n.. code-block:: python\n\n from pylibpcap.pcap import wpcap\n\n\n buf = b'\\x00\\xc0\\x9f2A\\x8c\\x00\\xe0\\x18\\xb1\\x0c\\xad\\x08\\x00E\\x00\\x008' \\\n b'\\x00\\x00@\\x00@\\x11eG\\xc0\\xa8\\xaa\\x08\\xc0\\xa8\\xaa\\x14\\x80\\x1b' \\\n b'\\x005\\x00$\\x85\\xed\\x102\\x01\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00' \\\n b'\\x00\\x06google\\x03com\\x00\\x00\\x10\\x00\\x01'\n\n\n wpcap(buf, \"pcap.pcap\")\n wpcap([buf, buf], \"pcap.pcap)\n\nMerge pcap:\n\n.. code-block:: python\n\n from pylibpcap.pcap import mpcap\n\n\n mpcap(\"demo.pcap\", \"demo2.pcap\")\n\n mpcap(\"pcap/\", \"output.pcap\", \"port 502\")\n\nGet first iface:\n\n.. code-block:: python\n\n from pylibpcap.pcap import get_first_iface\n\n print(get_first_iface())\n\nCapture data:\n\n.. code-block:: python\n\n from pylibpcap.pcap import sniff\n\n\n for plen, t, buf in sniff(\"enp2s0\", filters=\"port 53\", count=3, promisc=1, out_file=\"pcap.pcap\"):\n print(\"[+]: Payload len=\", plen)\n print(\"[+]: Time\", t)\n print(\"[+]: Payload\", buf)\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `caizhengxin/cookiecutter-package`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`caizhengxin/cookiecutter-package`: https://github.com/caizhengxin/cookiecutter-package", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/caizhengxin/python-libpcap.git", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/caizhengxin/python-libpcap", "keywords": "python-libpcap,pylibpcap,libpcap,pcap,python,linpcap-python", "license": "BSD", "maintainer": "JanKinCai", "maintainer_email": "jankincai12@gmail.com", "name": "python-libpcap", "package_url": "https://pypi.org/project/python-libpcap/", "platform": "Linux", "project_url": "https://pypi.org/project/python-libpcap/", "project_urls": { "Documentation": "https://python-libpcap.readthedocs.io", "Download": "https://github.com/caizhengxin/python-libpcap.git", "Homepage": "https://github.com/caizhengxin/python-libpcap", "Source Code": "https://github.com/caizhengxin/python-libpcap" }, "release_url": "https://pypi.org/project/python-libpcap/0.1.4/", "requires_dist": null, "requires_python": "", "summary": "Cython libpcap", "version": "0.1.4" }, "last_serial": 5930869, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "13ea595df269d5f217358bdb43d9e7dc", "sha256": "e42591478094ed28e66b46f3a07da38655f048a87db14f031c7e0f31f4a5cb16" }, "downloads": -1, "filename": "python-libpcap-0.1.0.tar.gz", "has_sig": false, "md5_digest": "13ea595df269d5f217358bdb43d9e7dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 46356, "upload_time": "2019-09-03T17:08:15", "url": "https://files.pythonhosted.org/packages/56/e0/83f56d169cbef4c425a66271d0b0f37292e987c62c2a13fccc1635467446/python-libpcap-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "0ed9da1dc7533b67872b90f8da428a91", "sha256": "bb4e4b9e390453f7e5a8544fc887c73a1e3f7d45bf24226fbd1c5ddb7c4c8daf" }, "downloads": -1, "filename": "python-libpcap-0.1.1.tar.gz", "has_sig": false, "md5_digest": "0ed9da1dc7533b67872b90f8da428a91", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 48827, "upload_time": "2019-09-04T06:40:49", "url": "https://files.pythonhosted.org/packages/cc/62/d3c0df4bc9a4f8c1505c583fe7373b70423d1e222032a2d0fa3a55cb534d/python-libpcap-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "2c9ad482599d1ef2e0e5e2184ff5931e", "sha256": "d2424d43c735e3c9c0a6a563d086ad6f7b7ddc51b95299e5c9f344cca004b460" }, "downloads": -1, "filename": "python-libpcap-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2c9ad482599d1ef2e0e5e2184ff5931e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 60427, "upload_time": "2019-09-24T07:03:51", "url": "https://files.pythonhosted.org/packages/04/ba/035fbea47f9e822de756176c7708a10b4f22b2c7d2bce80720fcc03bb00e/python-libpcap-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "7ff1115d7d37029633d7921ab9ff6a82", "sha256": "07e7c3194dd6e4742a02fffc2f01a8b53eca1ee04cf9c687c8b68c03d7bafd75" }, "downloads": -1, "filename": "python-libpcap-0.1.3.tar.gz", "has_sig": false, "md5_digest": "7ff1115d7d37029633d7921ab9ff6a82", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 60449, "upload_time": "2019-09-25T08:29:29", "url": "https://files.pythonhosted.org/packages/f1/47/e631fa7e12582c40d0237ff10e6497c08c68b92160cee8c30115d22c3704/python-libpcap-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "19d4a2fab43d9974f75eed2653bf2408", "sha256": "d17b7dba4eb36416159d177e23ae127725cf640ce70f13dd18973eab44c0b4e2" }, "downloads": -1, "filename": "python-libpcap-0.1.4.tar.gz", "has_sig": false, "md5_digest": "19d4a2fab43d9974f75eed2653bf2408", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 60477, "upload_time": "2019-10-05T02:52:11", "url": "https://files.pythonhosted.org/packages/43/43/8c792bb67f867072bade4d5d6b5f0e67f475111e38bd968bda8cbfb679c5/python-libpcap-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "19d4a2fab43d9974f75eed2653bf2408", "sha256": "d17b7dba4eb36416159d177e23ae127725cf640ce70f13dd18973eab44c0b4e2" }, "downloads": -1, "filename": "python-libpcap-0.1.4.tar.gz", "has_sig": false, "md5_digest": "19d4a2fab43d9974f75eed2653bf2408", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 60477, "upload_time": "2019-10-05T02:52:11", "url": "https://files.pythonhosted.org/packages/43/43/8c792bb67f867072bade4d5d6b5f0e67f475111e38bd968bda8cbfb679c5/python-libpcap-0.1.4.tar.gz" } ] }