dnet.8.patch revision 5005
0N/A--- libdnet-1.12/test/dnet/dnet.8.orig 2012-05-23 08:30:25.629791399 -0700
0N/A+++ libdnet-1.12/test/dnet/dnet.8 2012-05-23 08:47:33.464415318 -0700
98N/A@@ -2,240 +2,235 @@
0N/A .\"
0N/A .\" Copyright (c) 2001 Dug Song <dugsong@monkey.org>
0N/A .\"
0N/A-.Dd October 17, 2001
0N/A-.Dt DNET 8
0N/A-.Os
0N/A-.Sh NAME
0N/A-.Nm dnet
0N/A-.Nd dumb networking library test program
0N/A-.Sh SYNOPSIS
0N/A-.Nm dnet Ar command Ar args Op ...
0N/A-.Sh DESCRIPTION
0N/A-.Nm
0N/A-is a simple test program for the
0N/A-.Xr dnet 3
0N/A+.TH "DNET" "8" "October 21, 2015" "SunOS 5.12" "System Manager's Manual"
0N/A+.SH "NAME"
0N/A+\fBdnet\fP
0N/A+\- dumb networking library test program
0N/A+.SH "SYNOPSIS"
0N/A+\fBdnet \fIcommand\fP \fIargs\fP [...]\fP
0N/A+.SH "DESCRIPTION"
0N/A+\fBdnet\fP
0N/A+is a simple test program for the
0N/A+dnet(3)
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-.Pp
0N/A-.Ss Payload generation commands
0N/A-.Bl -tag -width "foo"
98N/A-.It Nm addr Ar address Op ...
0N/A-Convert the
98N/A-.Ar address
0N/A+.PP
0N/A+.SS "Payload generation commands"
174N/A+.TP foo
8N/A+\fBaddr\fP \fIaddress\fP [...]
61N/A+Convert the
17N/A+\fIaddress\fP
98N/A (specified as a hostname, IP address, or MAC address)
98N/A into its binary representation on standard output.
0N/A-.It Nm hex Ar string Op ...
0N/A+.TP foo
70N/A+\fBhex\fP \fIstring\fP [...]
98N/A Convert the C-style escaped
98N/A-.Ar string
98N/A-(shellcode, for instance) into its binary representation on standard output.
0N/A-.It Nm rand Ar len
0N/A+\fIstring\fP
0N/A+(shellcode, for instance) into its binary representation on standard output.
0N/A+.TP foo
0N/A+\fBrand\fP \fIlen\fP
0N/A Write
0N/A-.Ar len
0N/A+\fIlen\fP
0N/A random bytes to standard output.
0N/A-.El
0N/A-.Ss Packet encapsulation commands
0N/A-.Bl -tag -width "foo"
0N/A-.It Xo
0N/A-.Nm eth
0N/A-.Op Nm type Ar type
0N/A-.Op Nm src Ar mac
0N/A-.Op Nm dst Ar mac
0N/A-.Xc
0N/A+.SS "Packet encapsulation commands"
0N/A+.TP foo
0N/A+\fBeth\fP
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-.Ar type
0N/A+\fItype\fP
0N/A may be specified as
0N/A-.Ql arp ,
0N/A-.Ql ip ,
0N/A+`arp',
0N/A+`ip',
0N/A or as a hex, octal, or decimal number.
0N/A-.It Xo
0N/A-.Nm arp
0N/A-.Op Nm op Ar op
0N/A-.Op Nm sha Ar mac
0N/A-.Op Nm spa Ar host
0N/A-.Op Nm tha Ar mac
0N/A-.Op Nm tpa Ar host
0N/A-.Xc
0N/A+.TP foo
0N/A+\fBarp\fP
0N/A+[\fBop\fP \fIop\fP]
0N/A+[\fBsha\fP \fImac\fP]
+[\fBspa\fP \fIhost\fP]
+[\fBtha\fP \fImac\fP]
+[\fBtpa\fP \fIhost\fP]
Prepend the data read from standard input with an ARP header on
standard output. The ARP
-.Ar op
+\fIop\fP
may be specified as
-.Ql req ,
-.Ql rep ,
-.Ql revreq ,
-.Ql revrep ,
+`req',
+`rep',
+`revreq',
+`revrep',
or as a hex, octal, or decimal number.
-.It Xo
-.Nm ip
-.Op Nm tos Ar num
-.Op Nm id Ar num
-.Op Nm off Ar offset
-.Op Nm ttl Ar num
-.Op Nm proto Ar protocol
-.Op Nm src Ar host
-.Bk -words
-.Op Nm dst Ar dst
-.Ek
-.Xc
+.TP foo
+\fBip\fP
+[\fBtos\fP \fInum\fP]
+[\fBid\fP \fInum\fP]
+[\fBoff\fP \fIoffset\fP]
+[\fBttl\fP \fInum\fP]
+[\fBproto\fP \fIprotocol\fP]
+[\fBsrc\fP \fIhost\fP]
+[\fBdst\fP \fIdst\fP]
Prepend the data read from standard input with an IP header on
standard output. The fragmentation
-.Ar offset
-may be specified as a decimal number (optionally concatenated with
-.Ql +
-to indicate more fragments) or as a hex number. The
-.Ar protocol
+\fIoffset\fP
+may be specified as a decimal number (optionally concatenated with
+`+'
+to indicate more fragments) or as a hex number. The
+\fIprotocol\fP
may be specified by name, or as a hex, octal, or decimal number.
-.It Xo
-.Nm icmp
-.Op Nm type Ar num
-.Op Nm code Ar num
-.Xc
+.TP foo
+\fBicmp\fP
+[\fBtype\fP \fInum\fP]
+[\fBcode\fP \fInum\fP]
Prepend the data read from standard input with an ICMP header on
standard output.
-.It Xo
-.Nm tcp
-.Op Nm sport Ar port
-.Op Nm dport Ar port
-.Op Nm flags Ar flags
-.Op Nm seq Ar num
-.Op Nm ack Ar num
-.Op Nm win Ar num
-.Op Nm urp Ar num
-.Xc
+.TP foo
+\fBtcp\fP
+[\fBsport\fP \fIport\fP]
+[\fBdport\fP \fIport\fP]
+[\fBflags\fP \fIflags\fP]
+[\fBseq\fP \fInum\fP]
+[\fBack\fP \fInum\fP]
+[\fBwin\fP \fInum\fP]
+[\fBurp\fP \fInum\fP]
Prepend the data read from standard input with a TCP header on
standard output. A
-.Ar port
-may be specified by name or hex, octal, or decimal number. The TCP
-.Ar flags
+\fIport\fP
+may be specified by name or hex, octal, or decimal number. The TCP
+\fIflags\fP
may be specified as some combination of the characters in the set
-.Ql SAFRPU
+`SAFRPU'
or as a hex number.
-.It Xo
-.Nm udp
-.Op Nm sport Ar port
-.Op Nm dport Ar port
-.Xc
+.TP foo
+\fBudp\fP
+[\fBsport\fP \fIport\fP]
+[\fBdport\fP \fIport\fP]
Prepend the data read from standard input with a UDP header on
standard output. A
-.Ar port
+\fIport\fP
may be specified by name or hex, octal, or decimal number.
-.El
-.Ss Packet transmission commands
-.Bl -tag -width "foo"
-.It Nm send Op Ar device
+.SS "Packet transmission commands"
+.TP foo
+\fBsend\fP [\fIdevice\fP]
Read a packet from standard input and send it over the network. If no
-.Ar device
+\fIdevice\fP
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.
-.El
-.Ss Kernel interface commands
-.Bl -tag -width "foo"
-.It Nm arp show
+.SS "Kernel interface commands"
+.TP foo
+\fBarp show\fP
Display the kernel ARP cache.
-.It Nm arp get Ar host
+.TP foo
+\fBarp get\fP \fIhost\fP
Display the kernel ARP entry for
-.Ar host .
-.It Nm arp add Ar host Ar mac
+\fIhost\fP.
+.TP foo
+\fBarp add\fP \fIhost\fP \fImac\fP
Add an ARP entry mapping the
-.Ar mac
+\fImac\fP
address for
-.Ar host .
-.It Nm arp delete Ar host
+\fIhost\fP.
+.TP foo
+\fBarp delete\fP \fIhost\fP
Delete the ARP entry for
-.Ar host .
-.Pp
-.It Nm fw show
+\fIhost\fP.
+.sp
+.TP foo
+\fBfw show\fP
Display the kernel firewall ruleset.
-.It Xo
-.Nm fw add Ns \&| Ns Nm delete
-.Ar action Ar direction Ar device
-.Ar protocol
-.Ar src Ns Op \&: Ns Ar port[-max]
-.Ar dst Ns Op \&: Ns Ar port[-max]
-.Op Ar type Ns Op /code
-.Xc
+.TP foo
+\fBfw add\fP\&|\fBdelete\fP
+\fIaction\fP \fIdirection\fP \fIdevice\fP
+\fIprotocol\fP
+\fIsrc\fP[\&:\fIport[-max]\fP]
+\fIdst\fP[\&:\fIport[-max]\fP]
+[\fItype\fP[/code]]
Add a rule to or delete a rule from the active firewall ruleset. The
-.Ar action
+\fIaction\fP
must be either
-.Ql allow
+`allow'
or
-.Ql block .
+`block'.
The direction must be either
-.Ql in
+`in'
or
-.Ql out .
-The
-.Ar device
-may specify an interface name, or
-.Ql any .
-The
-.Ar protocol
+`out'.
+The
+\fIdevice\fP
+may specify an interface name, or
+`any'.
+The
+\fIprotocol\fP
may be specified by name, or as a decimal number. For TCP and
-UDP protocols, a
-.Ar port
+UDP protocols, a
+\fIport\fP
(or range, if specified with a
-.Ar max
+\fImax\fP
value) may be specified in decimal and appended to the source and/or
destination address. For ICMP, a
-.Ar type
+\fItype\fP
(and optional
-.Ar code )
+\fIcode\fP)
may be specified in decimal.
-.It Nm intf show
+.TP foo
+\fBintf show\fP
Display the configuration of all network interfaces.
-.It Nm intf get Ar device
+.TP foo
+\fBintf get\fP \fIdevice\fP
Display the configuration for the interface specified by
-.Ar device .
-.It Xo
-.Nm intf set
-.Ar device
-.Op Nm alias Ar host
-.Op Nm dst Ar host
-.Op Nm inet Ar host
-.Op Nm link Ar mac
-.Op Nm up Ns \&| Ns Nm down
-.Op Nm arp Ns \&| Ns Nm noarp
-.Xc
+\fIdevice\fP.
+.TP foo
+\fBintf set\fP
+\fIdevice\fP
+[\fBalias\fP \fIhost\fP]
+[\fBdst\fP \fIhost\fP]
+[\fBinet\fP \fIhost\fP]
+[\fBlink\fP \fImac\fP]
+[\fBup\fP\&|\fBdown\fP]
+[\fBarp\fP\&|\fBnoarp\fP]
Configure the interface specified by
-.Ar device .
-.It Nm route show
+\fIdevice\fP.
+.TP foo
+\fBroute show\fP
Display the kernel routing table.
-.It Nm route get Ar dst
+.TP foo
+\fBroute get\fP \fIdst\fP
Display the route for the destination
-.Ar dst ,
+\fIdst\fP,
specified as a hostname, IP address, or network prefix in CIDR notation.
-.It Nm route add Ar dst Ar gw
+.TP foo
+\fBroute add\fP \fIdst\fP \fIgw\fP
Add a route for the destination
-.Ar dst
+\fIdst\fP
through the gateway
-.Ar gw .
-.It Nm route delete Ar dst
+\fIgw\fP.
+.TP foo
+\fBroute delete\fP \fIdst\fP
Delete the route for the destination
-.Ar dst .
-.El
-.Sh EXAMPLES
+\fIdst\fP.
+.SH "EXAMPLES"
Send a UDP datagram containing random shellcode:
-.Bd -literal -offset indent
+.nf
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
-.Ed
-.Pp
+.fi
+.PP
Save an ARP request in a file and send it twice:
-.Bd -literal -offset indent
+.nf
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
-.Ed
-.Pp
+.fi
+.PP
Send a fragmented ping packet:
-.Bd -literal -offset indent
+.nf
# 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
@@ -251,9 +246,9 @@
dnet send
dnet ip id 1 off 24 proto icmp src 1.2.3.4 dst 5.6.7.8 < p.ab | \\
dnet send
-.Ed
-.Sh SEE ALSO
-.Xr dnet 3
-.Sh AUTHORS
+.fi
+.SH "SEE ALSO"
+dnet(3)
+.SH "AUTHORS"
Dug Song
-.Aq dugsong@monkey.org
+<dugsong@monkey.org>