DNET(8)
π DNET(8) π
okay bestie, buckle up β this is the System Manager's Manual page for dnet, and yes it's a whole vibe β¨
πΈ NAME πΈ
dnet β dumb networking library test program π«Ά
π SYNOPSIS π
dnet command args [...]
β¨ DESCRIPTION β¨
dnet is a little test program for the dnet(3) library. It's lowkey a multitool: you can use it to compose and transmit network datagrams like some Unix-style filter (think reading from or writing to files and pipes, the way that pipes eat), or you can use it to modify the local system network configuration β and that means the ARP cache, the firewall ruleset, network interfaces, and the routing table. All of it. No cap. π
π Payload generation commands
addr address [...]β turns the address (given as a hostname, an IP address, or a MAC address) into its binary representation on standard output. bye hex-dumping manually πhex string [...]β turns the C-style escaped string (shellcode, for instance β yes, that kind) into its binary representation on standard output.rand lenβ writeslenrandom bytes to standard output. chaos, but make it byte-sized π
π¦ Packet encapsulation commands
eth [type type] [src mac] [dst mac]β prepends the data read from standard input with an Ethernet header on standard output. The Ethernet type can be'arp','ip', or a hex, octal, or decimal number.arp [op op] [sha mac] [spa host] [tha mac] [tpa host]β prepends the data read from standard input with an ARP header on standard output. The ARP op can be'req','rep','revreq','revrep', or a hex, octal, or decimal number.ip [tos num] [id num] [off offset] [ttl num] [proto protocol] [src host] [dst dst]β prepends the data read from standard input with an IP header on standard output. The fragmentation offset can be a decimal number (optionally concatenated with'+'to indicate more fragments) or a hex number. The protocol can be given by name, or as a hex, octal, or decimal number.icmp [type num] [code num]β prepends the data read from standard input with an ICMP header on standard output.tcp [sport port] [dport port] [flags flags] [seq num] [ack num] [win num] [urp num]β prepends the data read from standard input with a TCP header on standard output. A port can be given by name or as a hex, octal, or decimal number. The TCP flags can be some combination of the characters in the set'SAFRPU', or a hex number.udp [sport port] [dport port]β prepends the data read from standard input with a UDP header on standard output. A port can be given by name or as a hex, octal, or decimal number.
π Packet transmission commands
send [device]β reads a packet from standard input and sends it over the network. If you don't specify a device, the packet is assumed to be an IP datagram and gets routed to its destination. Otherwise the packet is assumed to be an Ethernet frame and is transmitted on the interface you named. main character packet behavior fr fr π₯
π Kernel interface commands
arp showβ display the kernel ARP cache.arp get hostβ display the kernel ARP entry for host.arp add host macβ add an ARP entry mapping the mac address for host.arp delete hostβ delete the ARP entry for host.fw showβ display the kernel firewall ruleset.fw add|delete action direction device protocol src[:port[-max]] dst[:port[-max]] [type[/code]]β add a rule to, or delete a rule from, the active firewall ruleset. The action must be either'allow'or'block'. The direction must be either'in'or'out'. The device may specify an interface name, or'any'. The protocol may be given by name, or as a decimal number. For TCP and UDP protocols, a port (or a range, if you give a max value) may be specified in decimal and appended to the source and/or destination address. For ICMP, a type (and optional code) may be specified in decimal.intf showβ display the configuration of all network interfaces.intf get deviceβ display the configuration for the interface specified by device.intf set device [alias host] [dst host] [inet host] [link mac] [up|down] [arp|noarp]β configure the interface specified by device.route showβ display the kernel routing table.route get dstβ display the route for the destination dst, specified as a hostname, an IP address, or a network prefix in CIDR notation.route add dst gwβ add a route for the destination dst through the gateway gw.route delete dstβ delete the route for the destination dst.
π EXAMPLES π
Send a UDP datagram containing random shellcode:
dnet hex "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89" \
"\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80" \
"\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff\xff\xff/bin/sh" | \
dnet udp sport 555 dport 666 | \
dnet ip proto udp src 1.2.3.4 dst 5.6.7.8 | dnet send
Save an ARP request in a file and send it twice:
dnet arp op req sha 0:d:e:a:d:0 spa 10.0.0.3 tpa 10.0.0.4 | \
dnet eth type arp src 0:d:e:a:d:0 dst ff:ff:ff:ff:ff:ff > arp.pkt
dnet send fxp0 < arp.pkt
dnet send fxp0 < arp.pkt
Send a fragmented ping packet:
# Create ping packet with IP header, to set ICMP checksum
echo "monkey monkey monkey monkey" | dnet icmp type 8 code 0 | \
dnet ip proto icmp src 1.2.3.4 dst 5.6.7.8 > ping.pkt
# Chop off IP header
dd if=ping.pkt of=ping.data bs=20 skip=1
# Fragment IP payload
split -b 24 ping.data p.
# Send fragments
dnet ip id 1 off 0+ proto icmp src 1.2.3.4 dst 5.6.7.8 < p.aa | \
dnet send
dnet ip id 1 off 24 proto icmp src 1.2.3.4 dst 5.6.7.8 < p.ab | \
dnet send
π§ SEE ALSO π§
π«Ά AUTHORS π«Ά
Dug Song β¨dugsong@monkey.orgβ©
Oliver Falk β¨oliver@linux-kernel.atβ©
okay that's the whole page bestie, go forth and packet β¨
π this Debian edition dropped on October 17, 2001 β vintage, iconic, and still serving π
π¦ where this page comes from
- alpine 3.22: libdnet-doc 1.17.0-r0 Β· BSD-3-Clause
- alpine 3.23: libdnet-doc 1.18.0-r0 Β· BSD-3-Clause
- alpine 3.24: libdnet-doc 1.18.0-r0 Β· BSD-3-Clause
- arch rolling: libdnet 1.18.2-1 Β· BSD
- epel 10: libdnet-progs 1.18.0-1.el10_1 Β· BSD-3-Clause
- fedora 43: libdnet-progs 1.18.0-8.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: libdnet-progs 1.18.0-9.fc44 Β· LicenseRef-Callaway-BSD
- nixos 26.05: libdnet 1.18.2
- nixpkgs unstable: libdnet 1.18.2
- Copyright (c) 2001 Dug Song <dugsong@monkey.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms