{"id":13775460,"url":"https://github.com/orweis/winpcapy","last_synced_at":"2026-03-06T11:31:51.845Z","repository":{"id":31169955,"uuid":"34730161","full_name":"orweis/winpcapy","owner":"orweis","description":"A Modern Python wrapper for WinPcap  ","archived":false,"fork":false,"pushed_at":"2024-04-18T12:52:59.000Z","size":43,"stargazers_count":77,"open_issues_count":6,"forks_count":22,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-11-28T19:56:35.598Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orweis.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-28T12:51:06.000Z","updated_at":"2024-12-30T20:00:44.000Z","dependencies_parsed_at":"2024-06-21T16:52:19.642Z","dependency_job_id":"2edde8bd-f5eb-4cb9-9aa2-fcfa8edd2cd9","html_url":"https://github.com/orweis/winpcapy","commit_stats":{"total_commits":20,"total_committers":8,"mean_commits":2.5,"dds":0.55,"last_synced_commit":"5c9504eea0abee74c2f437e3b0566a2e1845536f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/orweis/winpcapy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orweis%2Fwinpcapy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orweis%2Fwinpcapy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orweis%2Fwinpcapy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orweis%2Fwinpcapy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orweis","download_url":"https://codeload.github.com/orweis/winpcapy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orweis%2Fwinpcapy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30173694,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T07:56:45.623Z","status":"ssl_error","status_checked_at":"2026-03-06T07:55:55.621Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:01:39.093Z","updated_at":"2026-03-06T11:31:51.819Z","avatar_url":"https://github.com/orweis.png","language":"Python","funding_links":[],"categories":["\u003ca id=\"5303e6ae470e6def3b69d614674a1c46\"\u003e\u003c/a\u003eWinPcap"],"sub_categories":["\u003ca id=\"b239f12aca7aa942b45836032cbef99a\"\u003e\u003c/a\u003e转换"],"readme":"winpcapy\n========\n\n| A Modern Python wrapper for WinPcap\n| Access WinPcap through ctypes.\n\nBased on Massimo Ciani’s WinPcapy (https://code.google.com/p/winpcapy/)\n\n\nInstall\n-------\npip install winpcapy\n\nUsage\n-----\n\nQuick packet live log printer\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n    \u003e\u003e\u003e from winpcapy import WinPcapUtils\n    # run on the first Ethernert interface and print a log for each packet\n    \u003e\u003e\u003e WinPcapUtils.capture_on_and_print(\"*Ethernet*\")\n    16:05:49,624258 len:199\n    16:05:49,685950 len:60\n    16:05:49,686022 len:54\n    16:05:49,767311 len:66\n    16:05:49,819156 len:66\n    16:05:50,052113 len:92\n    16:05:50,128862 len:60\n\nEasy Packet live callback\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n    from winpcapy import WinPcapUtils\n\n    # Example Callback function to parse IP packets\n    def packet_callback(win_pcap, param, header, pkt_data):\n        # Assuming IP (for real parsing use modules like dpkt)\n        ip_frame = pkt_data[14:]\n        # Parse ips\n        src_ip = \".\".join([str(ord(b)) for b in ip_frame[0xc:0x10]])\n        dst_ip = \".\".join([str(ord(b)) for b in ip_frame[0x10:0x14]])\n        print(\"%s -\u003e %s\" % (src_ip, dst_ip))\n\n    WinPcapUtils.capture_on(\"*Ethernet*\", packet_callback)\n\nDevice/Interface enumeration\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n    \u003e\u003e\u003e from winpcapy import WinPcapDevices\n    # Return a list of all the devices detected on the machine\n    \u003e\u003e\u003e WinPcapDevices.list_devices()\n    {'\\\\Device\\\\NPF_{0A78B7C8-F023-1337-1337-84D448AA5126}': 'Microsoft',\n     '\\\\Device\\\\NPF_{2997B9BB-AA53-1337-1337-B862F874271C}': 'Microsoft',\n     '\\\\Device\\\\NPF_{C2EAA982-F851-1337-1337-B8D2A9BCE406}': 'Intel(R) Ethernet Connection I218-LM',\n     '\\\\Device\\\\NPF_{EAF47DBE-5B49-1337-1337-BD059E02666B}': 'Microsoft'}\n     \n     # Itearte over devices (in memory), with full details access\n    \u003e\u003e\u003e with WinPcapDevices() as devices:\n    ...     for device in devices:\n    ...         print device.name, device.description, device.flags ,device.addresses.contents.netmask.contents.sa_family\n    ...         \n    \"\\Device\\NPF_{0A78B7C8-F023-1337-1337-84D448AA5126} Microsoft 0 0\"\n    \"\\Device\\NPF_{C2EAA982-F851-1337-1337-B8D2A9BCE406} Intel(R) Ethernet Connection I218-LM 0 0\"\n    \"\\Device\\NPF_{EAF47DBE-5B49-1337-1337-BD059E02666B} Microsoft 0 0\"\n    \"\\Device\\NPF_{2997B9BB-AA53-1337-1337-B862F874271C} Microsoft 0 0\"\n\nEasy Packet sending\n~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n    from winpcapy import WinPcapUtils\n    # Build a packet buffer\n    # This example-code is built for tutorial purposes, for actual packet crafting use modules like dpkt\n    arp_request_hex_template = \"%(dst_mac)s%(src_mac)s08060001080006040001\" \\\n                               \"%(sender_mac)s%(sender_ip)s%(target_mac)s%(target_ip)s\" + \"00\" * 18\n    packet = arp_request_hex_template % {\n        \"dst_mac\": \"aa\"*6,\n        \"src_mac\": \"bb\"*6,\n        \"sender_mac\": \"bb\"*6,\n        \"target_mac\": \"cc\"*6,\n        # 192.168.0.1\n        \"sender_ip\": \"c0a80001\",\n        # 192.168.0.2\n        \"target_ip\": \"c0a80002\"\n    }\n    # Send the packet (ethernet frame with an arp request) on the interface\n    WinPcapUtils.send_packet(\"*Ethernet*\", packet.decode(\"hex\"))","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forweis%2Fwinpcapy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forweis%2Fwinpcapy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forweis%2Fwinpcapy/lists"}