6 releases

0.3.2 Jul 30, 2023
0.3.1 Mar 19, 2023
0.3.0 Aug 29, 2022
0.2.0 Jun 10, 2021
0.1.1 May 28, 2021

#497 in Network programming

Download history 49/week @ 2023-12-10 93/week @ 2023-12-17 20/week @ 2023-12-24 34/week @ 2023-12-31 19/week @ 2024-01-07 98/week @ 2024-01-14 47/week @ 2024-01-21 90/week @ 2024-01-28 153/week @ 2024-02-04 70/week @ 2024-02-11 134/week @ 2024-02-18 169/week @ 2024-02-25 110/week @ 2024-03-03 130/week @ 2024-03-10 207/week @ 2024-03-17 95/week @ 2024-03-24

551 downloads per month

MIT license

22KB
450 lines

arp-toolkit Build crates.io

Toolkit for (R)ARP , the (Reverse) Address Resolution Protocol.

Supports simplified sending and receiving of (R)ARP requests/responses using an abstracted Client. Also allows easy manipulation and building of (R)ARP packets.

Features:

  • Sending and receiving ARP/RARP messages
  • Abstracted ARP client with simple access to most common ARP/RARP use cases
  • Advanced API, allowing for arbitrary construction and manipulation of ARP/RARP packets
  • Sync (blocking) and async IO

Build

To build it, use

cargo build

Note: only the async-example is built per default. To build the sync-example, change to the directory and run cargo build. This is because sync and async can not be used in the same crate simultaneously.

Usage

examples/sync-example shows high-level usage of the class ArpClient using blocking IO. For example, it illustrates how to get the MAC address for the corresponding IP and vice versa with a single function call. async-example shows the same, but with async IO.

It is also possible to directly send, receive and manipulate (R)ARP packages. To see how this works, take a look at the both of the examples and their containing method resolve_advanced.

To use blocking IO instead of async IO, activate the feature sync in your Cargo.toml like this:

[dependencies]
arp-toolkit = {version = x.x.x, features = ["sync"]}

Important note: As this library uses Raw sockets, either set the CAP_NET_RAW capability or run your program with sudo. (not recommended)

Dependencies

~3–4.5MB
~81K SLoC