netforge
High-performance raw packet I/O engine for internet-scale scanning. Three
backends, auto-selected by system capability, with a unified
PacketEngine trait.
| Backend | Feature | Throughput | Requirements |
|---|---|---|---|
| AF_XDP | xdp-backend |
25M+ pps | Kernel 5.10+, CAP_BPF, libbpf |
| sendmmsg | sendmmsg-backend |
10M+ pps | Linux, CAP_NET_RAW |
| pnet | pnet-backend |
1M pps | Any platform with CAP_NET_RAW |
auto_select() tries the fastest available backend first and falls
through on construction failure.
Install
[]
= "0.1"
Default features compile in sendmmsg-backend + pnet-backend. Opt
into AF_XDP explicitly:
= { = "0.1", = ["xdp-backend"] }
Usage
use ;
use Ipv4Addr;
let config = EngineConfig ;
let engine = auto_select?;
let mut tmpl = build_syn_template;
stamp_syn;
let sent = engine.tx_batch?;
println!;
let stats = engine.stats;
println!;
# Ok::
Stateless sequence encoding
The seq module provides cryptographically-keyed TCP sequence number
encoding for fully stateless SYN scanning. The full probe identity
(src_ip, dst_ip, dst_port, src_port, phase) is encoded into the 32-bit
sequence number using a keyed hash; SYN-ACK responses are verified
against the hash at receive time, with zero per-connection state.
use ;
use Ipv4Addr;
let enc = with_cookie;
let seq = enc.encode;
// Later, when a SYN-ACK arrives with ack_num = seq + 1:
assert!;
SIMD-friendly checksums
The checksum module provides the Internet checksum (RFC 1071) for IP
and TCP headers. The implementation uses a folded-32-bit-sum form that
LLVM auto-vectorises into 32-byte AVX2 chunks on x86_64.
License
Dual-licensed under either of:
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.