diff options
author | ericj <> | 2001-06-26 06:55:06 +0000 |
---|---|---|
committer | ericj <> | 2001-06-26 06:55:06 +0000 |
commit | 189642a183446e4622656043980cd1d6514accba (patch) | |
tree | 9d1c8b9179a8565e7f8a1ea54a2453bbbe69ef1e /src/usr.bin/nc/nc.1 | |
parent | c1a04a96f0f90d6447fb2b5ce7c4fc1d4d6deadb (diff) | |
download | openbsd-189642a183446e4622656043980cd1d6514accba.tar.gz openbsd-189642a183446e4622656043980cd1d6514accba.tar.bz2 openbsd-189642a183446e4622656043980cd1d6514accba.zip |
update this man page for the new netcat
Diffstat (limited to 'src/usr.bin/nc/nc.1')
-rw-r--r-- | src/usr.bin/nc/nc.1 | 184 |
1 files changed, 67 insertions, 117 deletions
diff --git a/src/usr.bin/nc/nc.1 b/src/usr.bin/nc/nc.1 index b7343d5e57..c659d2b2b9 100644 --- a/src/usr.bin/nc/nc.1 +++ b/src/usr.bin/nc/nc.1 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: nc.1,v 1.12 2001/05/04 01:38:31 millert Exp $ | 1 | .\" $OpenBSD: nc.1,v 1.13 2001/06/26 06:55:06 ericj Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1996 David Sacerdote | 3 | .\" Copyright (c) 1996 David Sacerdote |
4 | .\" All rights reserved. | 4 | .\" All rights reserved. |
@@ -25,7 +25,7 @@ | |||
25 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | .\" | 27 | .\" |
28 | .Dd August 1, 1996 | 28 | .Dd June 25, 2001 |
29 | .Dt NC 1 | 29 | .Dt NC 1 |
30 | .Os | 30 | .Os |
31 | .Sh NAME | 31 | .Sh NAME |
@@ -33,39 +33,33 @@ | |||
33 | .Nd "arbitrary TCP and UDP connections and listens" | 33 | .Nd "arbitrary TCP and UDP connections and listens" |
34 | .Sh SYNOPSIS | 34 | .Sh SYNOPSIS |
35 | .Nm nc | 35 | .Nm nc |
36 | .Op Fl lnrtuvz | 36 | .Op Fl 46hklnrtuvz |
37 | .Op Fl g Ar intermediates | ||
38 | .Op Fl G Ar hopcount | ||
39 | .Op Fl i Ar interval | 37 | .Op Fl i Ar interval |
40 | .Op Fl o Ar filename | ||
41 | .Op Fl p Ar source port | 38 | .Op Fl p Ar source port |
42 | .Op Fl s Ar ip address | 39 | .Op Fl s Ar source ip address |
43 | .Op Fl w Ar timeout | 40 | .Op Fl w Ar timeout |
44 | .Op Ar hostname | 41 | .Op Ar hostname |
45 | .Op Ar port[s...] | 42 | .Op Ar port[s] |
46 | .Sh DESCRIPTION | 43 | .Sh DESCRIPTION |
47 | The | 44 | The |
48 | .Nm | 45 | .Nm |
49 | (or | 46 | (or |
50 | .Nm netcat ) | 47 | .Nm netcat ) |
51 | utility is used for just about anything under the sun | 48 | utility is used for just about anything under the sun involving TCP |
52 | involving TCP or UDP. | 49 | or UDP. |
53 | It can open TCP connections, send UDP packets, | 50 | It can open TCP connections, send UDP packets, listen on arbitrary |
54 | listen on arbitrary TCP and UDP ports, do port scanning, and source | 51 | TCP and UDP ports, do port scanning, and deal with both IPv4 and |
55 | routing. | 52 | IPv6. |
56 | Unlike | 53 | Unlike |
57 | .Xr telnet 1 , | 54 | .Xr telnet 1 , |
58 | .Nm | 55 | .Nm |
59 | scripts nicely, and separates error messages onto standard error instead | 56 | scripts nicely, and separates error messages onto standard error instead |
60 | of sending them to standard output, as | 57 | of sending them to standard output, as |
61 | .Xr telnet 1 | 58 | .Xr telnet 1 , |
62 | does with some. | 59 | does with some. |
63 | .Pp | 60 | .Pp |
64 | Destination ports can be single integers, names as listed in | 61 | Destination ports can be single integers or ranges. |
65 | .Xr services 5 , | 62 | Ranges are in the form nn-mm. |
66 | or ranges. | ||
67 | Ranges are in the form nn-mm, and several separate ports and/or | ||
68 | ranges may be specified on the command line. | ||
69 | .Pp | 63 | .Pp |
70 | Common uses include: | 64 | Common uses include: |
71 | .Pp | 65 | .Pp |
@@ -77,153 +71,109 @@ shell\-script based HTTP clients and servers | |||
77 | .It | 71 | .It |
78 | network daemon testing | 72 | network daemon testing |
79 | .It | 73 | .It |
80 | source routing based connectivity testing | 74 | network daemon testing |
81 | .It | 75 | .It |
82 | and much, much more | 76 | and much, much more |
83 | .El | 77 | .El |
84 | .Pp | 78 | .Pp |
85 | The options are as follows: | 79 | The options are as follows: |
86 | .Bl -tag -width Ds | 80 | .Bl -tag -width Ds |
87 | .It Fl g Ar intermediate-host | 81 | .It Fl 4 |
88 | Specifies a hop along a loose source routed path. | 82 | Forces |
89 | Can be used more than once to build a chain of hop points. | 83 | .Nm |
90 | .It Fl G Ar pointer | 84 | to use IPv4 addresses only. |
91 | Positions the | 85 | .It Fl 6 |
92 | .Dq hop counter | 86 | Forces |
93 | within the list of machines in the path of a source routed packet. | 87 | .Nm |
94 | Must be a multiple of 4. | 88 | to use IPv6 addresses only. |
95 | .It Fl i Ar seconds | 89 | .It Fl h |
90 | Prints out | ||
91 | .Nm | ||
92 | help. | ||
93 | .It Fl i Ar interval | ||
96 | Specifies a delay time interval between lines of text sent and received. | 94 | Specifies a delay time interval between lines of text sent and received. |
97 | Also causes a delay time between connections to multiple ports. | 95 | Also causes a delay time between connections to multiple ports. |
96 | .It Fl k | ||
97 | Forces | ||
98 | .Nm | ||
99 | to stay listen for another connection after it's current connection | ||
100 | is completed. | ||
98 | .It Fl l | 101 | .It Fl l |
99 | Is used to specify that | 102 | Used to specify that |
100 | .Nm | 103 | .Nm |
101 | should listen for an incoming connection, rather than initiate a | 104 | should listen for an incoming connection rather than initiate a |
102 | connection to a remote host. | 105 | connection to a remote host. |
103 | Any hostname/IP address and port arguments | ||
104 | restrict the source of inbound connections to only that address and | ||
105 | source port. | ||
106 | .It Fl n | 106 | .It Fl n |
107 | Do not do DNS lookups on any of the specified addresses or hostnames, or | 107 | Do not do any DNS or service lookups on any specified addresses or |
108 | names of port numbers from /etc/services. | 108 | hostnames, or ports. |
109 | .It Fl o Ar filename | ||
110 | Create a hexadecimal log of data transferred in the specified file. | ||
111 | Each line begins with | ||
112 | .Ql < | ||
113 | or | ||
114 | .Ql > . | ||
115 | .Ql < | ||
116 | means | ||
117 | .Dq from the net | ||
118 | and | ||
119 | .Ql > | ||
120 | means | ||
121 | .Dq to the net . | ||
122 | .It Fl p Ar port | 109 | .It Fl p Ar port |
123 | Specifies the source port | 110 | Specifies the source port |
124 | .Nm | 111 | .Nm |
125 | should use, subject to privilege restrictions and availability. | 112 | should use, subject to privilege restrictions and availability. |
126 | .It Fl r | 113 | .It Fl r |
127 | Specifies that source and/or destination ports should be chosen semi-randomly | 114 | Specifies that source and/or destination ports should be chosen randomly |
128 | instead of sequentially within a range or in the order that the | 115 | instead of sequentially within a range or in the order that the system |
129 | system assigns. | 116 | assigns. |
130 | .It Fl s Ar hostname/ip-address | 117 | .It Fl s Ar hostname/ip address |
131 | Specifies the IP of the interface which is used to send the packets. | 118 | Specifies the IP of the interface which is used to send the packets. |
132 | On some platforms, this can be used for UDP spoofing by using | ||
133 | .Xr ifconfig 8 | ||
134 | to bring up a dummy interface with the desired source IP address. | ||
135 | .It Fl t | 119 | .It Fl t |
136 | Causes | 120 | Causes |
137 | .Nm | 121 | .Nm |
138 | to send RFC854 DON'T and WON'T responses to RFC854 DO | 122 | to send RFC854 DON'T and WON'T responses to RFC854 DO and WILL requests. |
139 | and WILL requests. | ||
140 | This makes it possible to use | 123 | This makes it possible to use |
141 | .Nm | 124 | .Nm |
142 | to script telnet sessions. | 125 | to script telnet sessions. |
143 | The presence of this option can be | ||
144 | enabled or disabled as a compile-time option. | ||
145 | .It Fl u | 126 | .It Fl u |
146 | Use UDP instead of TCP. | 127 | Use UDP instead of the default option of TCP. |
147 | On most platforms, | ||
148 | .Nm | ||
149 | will behave as if a connection is established until it receives an | ||
150 | ICMP packet indicating that there is no program listening to what it | ||
151 | sends. | ||
152 | .It Fl v | 128 | .It Fl v |
153 | Verbose. | 129 | Have |
154 | Cause | ||
155 | .Nm | ||
156 | to display connection information. | ||
157 | Using | ||
158 | .Fl v | ||
159 | more than once will cause | ||
160 | .Nm | 130 | .Nm |
161 | to become even more verbose. | 131 | give more verbose output. |
162 | .It Fl w Ar timeout | ||
163 | Specifies the number of seconds | ||
164 | .Nm | ||
165 | should wait before deciding that | ||
166 | an attempt to establish a connection is hopeless. | ||
167 | Also used to specify how long to wait for more network data after standard | ||
168 | input closes. | ||
169 | .It Fl z | 132 | .It Fl z |
170 | Specifies that | 133 | Specifies that |
171 | .Nm | 134 | .Nm |
172 | should just scan for listening | 135 | should just scan for listening daemons, without sending any data to them. |
173 | daemons, without sending any data to them. | ||
174 | Diagnostic messages about refused connections will not be displayed unless | ||
175 | .Fl v | ||
176 | is specified twice. | ||
177 | .El | 136 | .El |
178 | .Sh EXAMPLES | 137 | .Sh EXAMPLES |
179 | .Bl -tag -width x | 138 | .Bl -tag -width x |
180 | .It Li "nc" | 139 | .It Li "nc hostname 42" |
181 | Wait for the user to type what would normally be command-line | 140 | Open a TCP connection to port 42 of hostname. |
182 | arguments on stdin. | 141 | .It Li "nc -p 31337 hostname 42" |
183 | .It Li "nc example.host 42" | 142 | Open a TCP connection to port 42 of hostname, and use port 31337 as |
184 | Open a TCP connection to port 42 of example.host. | 143 | the source port. |
185 | If the connection | 144 | .It Li "nc -w 5 hostname 42" |
186 | fails, do not display any error messages, but simply exit. | 145 | Open a TCP connection to port 42 of hostname, and timeout after |
187 | .It Li "nc -p 31337 example.host 42" | ||
188 | Open a TCP connection to port 42 of example.host, and use port 31337 | ||
189 | as the source port. | ||
190 | .It Li "nc -w 5 example.host 42" | ||
191 | Open a TCP connection to port 42 of example.host, and time out after | ||
192 | five seconds while attempting to connect. | 146 | five seconds while attempting to connect. |
193 | .It Li "nc -u example.host 53" | 147 | .It Li "nc -u hostname 53" |
194 | Send any data from stdin | 148 | Open a UDP connection to port 53 of hostname. |
195 | to UDP port 53 of example.host, and display any data returned. | ||
196 | .It Li "nc -s 10.1.2.3 example.host 42" | 149 | .It Li "nc -s 10.1.2.3 example.host 42" |
197 | Open a TCP connection to port 42 of example.host using 10.1.2.3 as the | 150 | Open a TCP connection to port 42 of example.host using 10.1.2.3 as the |
198 | IP for the local end of the connection. | 151 | IP for the local end of the connection. |
199 | .It Li "nc -v example.host 42" | 152 | .It Li "nc -v hostname 42" |
200 | Open a TCP connection to port 42 of example.host, displaying some | 153 | Open a TCP connection to port 42 of hostname, displaying some |
201 | diagnostic messages on stderr. | 154 | diagnostic messages on stderr. |
202 | .It Li "nc -v -v example.host 42" | 155 | .It Li "nc -v -v hostname 42" |
203 | Open a TCP connection to port 42 of example.host, displaying all | 156 | Open a TCP connection to port 42 of hostname, displaying all |
204 | diagnostic messages on stderr. | 157 | diagnostic messages on stderr. |
205 | .It Li "nc -v -z example.host 20-30" | 158 | .It Li "nc -v -z hostname 20-30" |
206 | Attempt to open TCP connections to ports 20 through 30 of | 159 | Attempt to open TCP connections to ports 20 through 30 of |
207 | example.host, and report which ones | 160 | hostname , and report which ones |
208 | .Nm | 161 | .Nm |
209 | was able to connect to. | 162 | was able to connect to. |
210 | .It Li "nc -v -u -z -w 3 example.host 20-30" | 163 | .It Li "nc -v -u -z -w 3 hostname 20-30" |
211 | Send UDP packets to ports 20-30 of example.host, and report which ones | 164 | Send UDP packets to ports 20-30 of example.host, and report which ones |
212 | did not respond with an ICMP packet after three seconds. | 165 | did not respond with an ICMP packet after three seconds. |
213 | .It Li "nc -l -p 3000" | 166 | .It Li "nc -l -p 3000" |
214 | Listen on TCP port 3000, and once there is a connection, send stdin to | 167 | Listen on TCP port 3000, and once there is a connection, send stdin to |
215 | the remote host, and send data from the remote host to stdout. | 168 | the remote host, and send data from the remote host to stdout. |
216 | .It Li "echo foobar | nc example.host 1000" | 169 | .It Li "echo foobar | nc hostname 1000" |
217 | Connect to port 1000 of example.host, send the string "foobar" | 170 | Connect to port 1000 of hostname, send the string "foobar" |
218 | followed by a newline, and move data from port 1000 of example.host to | 171 | followed by a newline, and move data from port 1000 of hostname to |
219 | stdout until example.host closes the connection. | 172 | stdout until hostname closes the connection. |
220 | .El | 173 | .El |
221 | .Sh SEE ALSO | 174 | .Sh SEE ALSO |
222 | .Xr cat 1 , | 175 | .Xr cat 1 , |
223 | .Xr telnet 1 | 176 | .Xr telnet 1 |
224 | .Pp | ||
225 | The | ||
226 | .Nm netcat | ||
227 | .Pa README . | ||
228 | .Sh AUTHOR | 177 | .Sh AUTHOR |
229 | *Hobbit* [hobbit@avian.org] | 178 | Original implementation by *Hobbit* [hobbit@avian.org]. |
179 | Rewritten with IPv6 support by Eric Jackson <ericj@monkey.org>. | ||