10 protocols. 66 CLI commands. 60+ Python bindings. PCAP support. Built for security research, penetration testing, and network tools.
Nim engine + Python bindings + REST API — use it however you want.
import nimpacket as np
# Build a TCP SYN packet
pkt = np.build_tcp_syn_packet("192.168.1.100", "10.0.0.1", 54321, 80)
# Save to PCAP (opens in Wireshark)
np.write_pcap("crafted.pcap", [pkt])
# Parse any packet from hex
result = np.parse_packet(pkt)
print(result["tcp"]["dst_port"]) # 80
# Get PCAP stats
stats = np.pcap_stats("capture.pcap")
print(stats["protocols"]) # {"tcp": 120, "udp": 15, ...}
# Craft packets from the command line
$ nimpacket craft tcp-syn --src 192.168.1.100 --dst 10.0.0.1 --dport 80
$ nimpacket craft udp --src 10.0.0.1 --dst 8.8.8.8 --dport 53 --payload "hello"
# Parse raw packets
$ nimpacket parse auto --hex 4500002800010000...
# PCAP analysis
$ nimpacket pcap stats capture.pcap
$ nimpacket pcap filter capture.pcap --protocol tcp --output tcp.pcap
$ nimpacket pcap replay capture.pcap --speed 2.0
# Network scanning
$ nimpacket scan syn --target 192.168.1.1 --ports 1-1000
# Craft a packet over HTTP
$ curl -X POST https://apexnet.onrender.com/api/craft/tcp/syn \
-H "Content-Type: application/json" \
-d '{"src_ip":"192.168.1.100","dst_ip":"10.0.0.1","src_port":54321,"dst_port":80}'
# Response:
{
"packet_hex": "4500002824aa0000...",
"size": 40,
"protocol": "tcp_syn"
}
# Parse, get PCAP stats, compute checksums — all via API
# Full Swagger docs at /docs
import nimpacket
# Create a TCP SYN packet
let ipv4 = IPv4Header(
srcIP: parseIPv4("192.168.1.100"),
dstIP: parseIPv4("10.0.0.1"),
protocol: IPPROTO_TCP
)
let tcp = TCPHeader(
srcPort: 12345,
dstPort: 80,
flags: TCP_SYN
)
# Stack layers and serialize
let packet = (ipv4 / tcp).toBytes()
echo "Packet ready: ", packet.len, " bytes"
IPv4, IPv6, TCP, UDP, ICMP, ICMPv6, Ethernet, ARP, DNS, DHCP. Complete control over every header field.
pip install nimpacket — 60+ functions. Craft, parse, send packets, and analyze PCAPs from Python.
Craft, parse, send, scan, listen, fragment, PCAP tools, and utilities. All from the terminal.
Read, write, filter, and replay .pcap files. Wireshark compatible. Deterministic replay engine with adjustable speed.
5 evasion strategies: TinyFragments, OverlapPoison, OutOfOrder, TimeDelayed, PolymorphicRandom.
Pure Nim engine. No libpcap, no external C libraries. Easy to audit and deploy anywhere.
Compiles to machine code. Optimized checksums. Minimal memory allocations. Faster than Python-based alternatives.
Send and receive packets directly. Port scanning, network discovery, and custom tools. Requires admin privileges.
$ pip install nimpacket
$ nimble install nimpacket
import nimpacket as np
# Craft a TCP SYN
pkt = np.build_tcp_syn_packet("192.168.1.100", "10.0.0.1", 54321, 80)
print(f"Packet: {pkt.hex()}")
# Parse it back
parsed = np.parse_packet(pkt)
print(parsed["ipv4"]["src_ip"]) # 192.168.1.100
# Save to PCAP (opens in Wireshark)
np.write_pcap("output.pcap", [pkt])
All of NimPacket's power as a REST API. Craft packets, parse hex, analyze PCAPs — from any language, any platform, over HTTP.
Build TCP, UDP, ICMP, ARP, DNS, DHCP, IPv6, Ethernet packets from JSON parameters.
POST /api/craft/tcp/syn
Decode raw packet hex into structured JSON. Auto-detects protocol or parse specific layers.
POST /api/parse
Upload .pcap files for stats, filtering, and deterministic replay scheduling.
POST /api/pcap/stats
Checksums, IP fragmentation with 5 evasion strategies, byte conversions.
POST /api/util/fragment
42 endpoints • Free to use • No API key required
66 commands. Everything from packet crafting to PCAP replay, right in your terminal.
$ nimpacket craft tcp-syn --src 192.168.1.1 --dst 10.0.0.1 --dport 80
$ nimpacket pcap stats capture.pcap
$ nimpacket pcap replay capture.pcap --speed 2.0 --protocol tcp
$ nimpacket scan syn --target 192.168.1.0/24 --ports 80,443
| Feature | NimPacket | Scapy |
|---|---|---|
| Performance | Native (Fast) | Interpreted (Slow) |
| Dependencies | Zero | Many |
| Python Bindings | 60+ functions | Native Python |
| CLI Tool | 66 commands | Interactive only |
| REST API | 42 endpoints | None |
| PCAP Support | Read/Write/Filter/Replay | Full (via libpcap) |
| IP Fragmentation | 5 evasion strategies | Basic |
| Protocol Count | 10 core protocols | Hundreds |
| Type Safety | Compile-time | Runtime |
Craft custom TCP SYN packets for port discovery. SYN, UDP, Ping, and ARP scan modes built in.
Read capture files, get protocol stats, filter by protocol, and replay traffic with exact timing.
Test detection systems with 5 IP fragmentation evasion strategies. Replay known-bad traffic at the firewall.
Send malformed or edge-case packets. Test DNS, DHCP, ARP implementations with crafted payloads.
ARP requests to map topology. ICMP ping sweeps. Identify hosts and services on your network.
Use ApexNet to add packet crafting to any app. Web dashboards, security tools, automation — over HTTP.
Full docs, API reference, CLI guide, and PCAP documentation on GitHub.