{"id":13439847,"url":"https://github.com/libpnet/libpnet","last_synced_at":"2025-05-13T15:13:23.378Z","repository":{"id":20243209,"uuid":"23515627","full_name":"libpnet/libpnet","owner":"libpnet","description":"Cross-platform, low level networking using the Rust programming language.","archived":false,"fork":false,"pushed_at":"2025-01-23T20:17:31.000Z","size":1491,"stargazers_count":2412,"open_issues_count":126,"forks_count":315,"subscribers_count":30,"default_branch":"main","last_synced_at":"2025-04-23T21:43:24.224Z","etag":null,"topics":["cross-platform","datalink","libpnet","networking","packets","rust","transport-protocols","winpcap"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libpnet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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,"zenodo":null}},"created_at":"2014-08-31T14:44:47.000Z","updated_at":"2025-04-22T20:35:09.000Z","dependencies_parsed_at":"2024-05-30T19:11:21.654Z","dependency_job_id":"3aca0065-c60d-424a-87c8-b2c7b119589d","html_url":"https://github.com/libpnet/libpnet","commit_stats":{"total_commits":740,"total_committers":150,"mean_commits":4.933333333333334,"dds":0.6864864864864865,"last_synced_commit":"468ba0b488dfdb4706997eb7ce39e803f5092ce9"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libpnet%2Flibpnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libpnet%2Flibpnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libpnet%2Flibpnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libpnet%2Flibpnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libpnet","download_url":"https://codeload.github.com/libpnet/libpnet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253969267,"owners_count":21992265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cross-platform","datalink","libpnet","networking","packets","rust","transport-protocols","winpcap"],"created_at":"2024-07-31T03:01:17.607Z","updated_at":"2025-05-13T15:13:18.240Z","avatar_url":"https://github.com/libpnet.png","language":"Rust","readme":"# libpnet [![Crates.io](https://img.shields.io/crates/v/pnet.svg)](https://crates.io/crates/pnet) ![License](https://img.shields.io/crates/l/pnet.svg) [![Documentation](https://docs.rs/pnet/badge.svg)](https://docs.rs/pnet/)\n\nBuild Status: [![Build Status](https://github.com/libpnet/libpnet/actions/workflows/ci.yml/badge.svg)](https://github.com/libpnet/libpnet/actions/workflows/ci.yml)\n\nDiscussion and support:\n\n * Live chat on IRC - [#libpnet on irc.libera.chat](https://kiwiirc.com/nextclient/irc.libera.chat/libpnet?nick=pnet-user42)\n * [GitHub Discussions](https://github.com/libpnet/libpnet/discussions)\n\n`libpnet` provides a cross-platform API for low level networking using Rust.\n\nThere are four key components:\n\n * The `packet` module, allowing safe construction and manipulation of packets;\n * The `pnet_macros` crate, providing infrastructure for the packet module;\n * The `transport` module, which allows implementation of transport protocols;\n * The `datalink` module, which allows sending and receiving data link packets directly.\n\n## Why?\n\nThere are lots of reasons to use low level networking, and many more to do it using Rust. A few are\noutlined here:\n\n### Developing Transport Protocols\n\nThere are usually two ways to go about developing a new transport layer protocol:\n\n * Write it in a scripting language such as Python;\n * Write it using C.\n\nThe former is great for trying out new ideas and rapid prototyping, however not so great as a\nreal-world implementation. While you can usually get reasonable performance out of these\nimplementations, they're generally significantly slower than an implementation in C, and not\nsuitable for any \"heavy lifting\".\n\nThe next option is to write it in C - this will give you great performance, but comes with a number\nof other issues:\n\n * Lack of memory safety - this is a huge source of security vulnerabilities and other bugs in\n   C-based network stacks. It is far too easy to forget a bounds check or use a pointer after it is\n   freed.\n * Lack of thread safety - you have to be very careful to make sure the correct locks are used, and\n   used correctly.\n * Lack of high level abstractions - part of the appeal of scripting languages such as Python is\n   the higher level of abstraction which enables simpler APIs and ease of programming.\n\nUsing `libpnet` and Rust, you get the best of both worlds. The higher level abstractions, memory\nand thread safety, alongside the performance of C.\n\n### Network Utilities\n\nMany networking utilities such as ping and traceroute rely on being able to manipulate network and\ntransport headers, which isn't possible with standard networking stacks such as those provided by\n`std::io::net`.\n\n### Data Link Layer\n\nIt can be useful to work directly at the data link layer, to see packets as they are \"on the wire\".\nThere are lots of uses for this, including network diagnostics, packet capture and traffic shaping.\n\n## Documentation\n\nAPI documentation for the latest build can be found here: https://docs.rs/pnet/\n\n## Usage\n\nTo use `libpnet` in your project, add the following to your Cargo.toml:\n\n```\n[dependencies.pnet]\nversion = \"0.35.0\"\n```\n\n`libpnet` should work with the latest stable version of Rust.\n\nWhen running the test suite, there are a number of networking tests which will\nlikely fail - the easiest way to workaround this is to run `cargo test` as a\nroot or administrative user. This can often be avoided, however it is more\ninvolved.\n\n### Windows\n\nThere are three requirements for building on Windows:\n\n * You must use a version of Rust which uses the MSVC toolchain\n * You must have [WinPcap](https://www.winpcap.org/) or [npcap](https://nmap.org/npcap/) installed\n   (tested with version WinPcap 4.1.3) (If using npcap, make sure to install with the \"Install Npcap in WinPcap API-compatible Mode\")\n * You must place `Packet.lib` from the [WinPcap Developers pack](https://www.winpcap.org/devel.htm)\n   in a directory named `lib`, in the root of this repository. Alternatively, you can use any of the\n   locations listed in the `%LIB%`/`$Env:LIB` environment variables. For the 64 bit toolchain it is\n   in `WpdPack/Lib/x64/Packet.lib`, for the 32 bit toolchain, it is in `WpdPack/Lib/Packet.lib`.\n","funding_links":[],"categories":["Libraries","Rust","Libraries \u0026 Frameworks:","库 Libraries","库","代码"],"sub_categories":["Network programming","rust","网络编程 Network programming","网络编程"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibpnet%2Flibpnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibpnet%2Flibpnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibpnet%2Flibpnet/lists"}