0N/A .\" Copyright (c) 2001 Dug Song <dugsong@monkey.org>
0N/A-.Nd dumb networking library test program
0N/A-is a simple test program for the
0N/A+.TH "DNET" "8" "October 21, 2015" "SunOS 5.12" "System Manager's Manual"
0N/A+\- dumb networking library test program
0N/A+\fBdnet \fIcommand\fP \fIargs\fP [...]\fP
0N/A+is a simple test program for the
0N/A library. It can be used to compose and transmit network datagrams as a
0N/A Unix-style filter (
e.g. reading from or writing to files and pipes) or
174N/A modify the local system network configuration (including the ARP
0N/A cache, firewall ruleset, network interfaces, and routing table).
0N/A+.SS "Payload generation commands"
8N/A+\fBaddr\fP \fIaddress\fP [...]
98N/A (specified as a hostname, IP address, or MAC address)
98N/A into its binary representation on standard output.
70N/A+\fBhex\fP \fIstring\fP [...]
98N/A Convert the C-style escaped
98N/A-(shellcode, for instance) into its binary representation on standard output.
0N/A+(shellcode, for instance) into its binary representation on standard output.
0N/A+\fBrand\fP \fIlen\fP
0N/A random bytes to standard output.
0N/A+.SS "Packet encapsulation commands"
0N/A+[\fBtype\fP \fItype\fP]
0N/A+[\fBsrc\fP \fImac\fP]
0N/A+[\fBdst\fP \fImac\fP]
0N/A Prepend the data read from standard input with an Ethernet header on
0N/A standard output. The Ethernet
0N/A or as a hex, octal, or decimal number.
0N/A+[\fBsha\fP \fImac\fP]
Prepend the data read from standard input with an ARP header on
or as a hex, octal, or decimal number.
-.Op Nm proto Ar protocol
+[\fBoff\fP \fIoffset\fP]
+[\fBproto\fP \fIprotocol\fP]
Prepend the data read from standard input with an IP header on
standard output. The fragmentation
-may be specified as a decimal number (optionally concatenated with
-to indicate more fragments) or as a hex number. The
+may be specified as a decimal number (optionally concatenated with
+to indicate more fragments) or as a hex number. The
may be specified by name, or as a hex, octal, or decimal number.
Prepend the data read from standard input with an ICMP header on
+[\fBsport\fP \fIport\fP]
+[\fBdport\fP \fIport\fP]
+[\fBflags\fP \fIflags\fP]
Prepend the data read from standard input with a TCP header on
-may be specified by name or hex, octal, or decimal number. The TCP
+may be specified by name or hex, octal, or decimal number. The TCP
may be specified as some combination of the characters in the set
+[\fBsport\fP \fIport\fP]
+[\fBdport\fP \fIport\fP]
Prepend the data read from standard input with a UDP header on
may be specified by name or hex, octal, or decimal number.
-.Ss Packet transmission commands
-.It Nm send Op Ar device
+.SS "Packet transmission commands"
+\fBsend\fP [\fIdevice\fP]
Read a packet from standard input and send it over the network. If no
is specified, the packet is assumed to be an IP datagram and routed
to its destination. Otherwise, the packet is assumed to be an Ethernet
frame and is transmitted on the specified interface.
-.Ss Kernel interface commands
+.SS "Kernel interface commands"
Display the kernel ARP cache.
+\fBarp get\fP \fIhost\fP
Display the kernel ARP entry for
-.It Nm arp add Ar host Ar mac
+\fBarp add\fP \fIhost\fP \fImac\fP
Add an ARP entry mapping the
-.It Nm arp delete Ar host
+\fBarp delete\fP \fIhost\fP
Display the kernel firewall ruleset.
-.Nm fw add Ns \&| Ns Nm delete
-.Ar action Ar direction Ar device
-.Ar src Ns Op \&: Ns Ar port[-max]
-.Ar dst Ns Op \&: Ns Ar port[-max]
+\fBfw add\fP\&|\fBdelete\fP
+\fIaction\fP \fIdirection\fP \fIdevice\fP
+\fIsrc\fP[\&:\fIport[-max]\fP]
+\fIdst\fP[\&:\fIport[-max]\fP]
Add a rule to or delete a rule from the active firewall ruleset. The
The direction must be either
-may specify an interface name, or
+may specify an interface name, or
may be specified by name, or as a decimal number. For TCP and
(or range, if specified with a
value) may be specified in decimal and appended to the source
and/or destination address. For ICMP, a
may be specified in decimal.
Display the configuration of all network interfaces.
-.It Nm intf get Ar device
+\fBintf get\fP \fIdevice\fP
Display the configuration for the interface specified by
-.Op Nm up Ns \&| Ns Nm down
-.Op Nm arp Ns \&| Ns Nm noarp
+[\fBalias\fP \fIhost\fP]
+[\fBarp\fP\&|\fBnoarp\fP]
Configure the interface specified by
Display the kernel routing table.
+\fBroute get\fP \fIdst\fP
Display the route for the destination
specified as a hostname, IP address, or network prefix in CIDR notation.
-.It Nm route add Ar dst Ar gw
+\fBroute add\fP \fIdst\fP \fIgw\fP
Add a route for the destination
-.It Nm route delete Ar dst
+\fBroute delete\fP \fIdst\fP
Delete the route for the destination
Send a UDP datagram containing random shellcode:
-.Bd -literal -offset indent
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:
-.Bd -literal -offset indent
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 Send a fragmented ping packet:
-.Bd -literal -offset indent
# 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 dnet ip id 1 off 24 proto icmp src 1.2.3.4 dst 5.6.7.8 <
p.ab | \\