version 1.38, 2005/05/20 10:55:09 |
version 1.39, 2005/07/17 19:15:38 |
|
|
in response to commands issued by the client. |
in response to commands issued by the client. |
For example, to retrieve the home page of a web site: |
For example, to retrieve the home page of a web site: |
.Pp |
.Pp |
.Dl $ echo \&"GET\&" | nc host.example.com 80 |
.Dl $ echo -n \&"GET / HTTP/1.0\er\en\er\en\&" | nc host.example.com 80 |
.Pp |
.Pp |
Note that this also displays the headers sent by the web server. |
Note that this also displays the headers sent by the web server. |
They can be filtered, using a tool such as |
They can be filtered, using a tool such as |
|
|
.Fl z |
.Fl z |
flag can be used to tell |
flag can be used to tell |
.Nm |
.Nm |
not to initiate a connection, |
to report open ports, |
together with the |
rather than initiate a connection. |
.Fl v |
|
.Pq verbose |
|
flag, |
|
to report open ports. |
|
For example: |
For example: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ nc -vz host.example.com 20-30 |
$ nc -z host.example.com 20-30 |
Connection to host.example.com 22 port [tcp/ssh] succeeded! |
Connection to host.example.com 22 port [tcp/ssh] succeeded! |
Connection to host.example.com 25 port [tcp/smtp] succeeded! |
Connection to host.example.com 25 port [tcp/smtp] succeeded! |
.Ed |
.Ed |
|
|
.Pp |
.Pp |
.Dl $ nc -s 10.1.2.3 host.example.com 42 |
.Dl $ nc -s 10.1.2.3 host.example.com 42 |
.Pp |
.Pp |
Send UDP packets to ports 20-30 of host.example.com, and report which ones |
|
responded with an ICMP packet after three seconds: |
|
.Pp |
|
.Dl $ nc -uvz -w 3 host.example.com 20-30 |
|
.Pp |
|
Create and listen on a Unix Domain Socket: |
Create and listen on a Unix Domain Socket: |
.Pp |
.Pp |
.Dl $ nc -lU /var/tmp/dsocket |
.Dl $ nc -lU /var/tmp/dsocket |
|
|
.br |
.br |
Rewritten with IPv6 support by |
Rewritten with IPv6 support by |
.An Eric Jackson Aq ericj@monkey.org . |
.An Eric Jackson Aq ericj@monkey.org . |
|
.Sh CAVEATS |
|
UDP port scans will always succeed |
|
(i.e. report the port as open), |
|
rendering the |
|
.Fl uz |
|
combination of flags relatively useless. |