Linux Man Page Viewer
The following form allows you to view linux man pages.
ncat [OPTIONS...] [hostname] [port]
Ncat is a feature-packed networking utility which will read and write
data across a network from the command line. Ncat was written for the
Nmap Project and is the culmination of the currently splintered family
of Netcat incarnations. It uses both TCP and UDP for communication and
is designed to be a reliable back-end tool to instantly provide network
connectivity to other applications and users. Ncat will not only work
with IPv4 and IPv6 but provides the user with a virtually limitless
number of potential uses.
Among Ncat?s vast number of features there is the ability to chain
Ncats together, redirect both TCP and UDP ports to other sites, SSL
support, and proxy connections via SOCKS4 or HTTP (CONNECT method)
proxies (with optional proxy authentication as well). Some general
principles apply to most applications and thus give you the capability
of instantly adding networking support to software that would normally
never support it.
Ncat 5.21 ( http://nmap.org/ncat )
Usage: ncat [options] [hostname] [port]
Options taking a time assume milliseconds, unless you append an ?s?
(seconds), ?m? (minutes), or ?h? (hours) to the value (e.g. 30s)
-4 Use IPv4 only
-6 Use IPv6 only
-C, --crlf Use CRLF for EOL sequence
-c, --sh-exec <command> Executes specified command via /bin/sh
-e, --exec <command> Executes specified command
-g hop1[,hop2,...] Loose source routing hop points (8 max)
-G n Loose source routing hop pointer (4, 8, 12, ...)
-m, --max-conns n Maximum n simultaneous connections
-h, --help Display this help screen
-d, --delay <time> Wait between read/writes
-o, --output Dump session data to a file
-x, --hex-dump Dump session data as hex to a file
-i, --idle-timeout <time> Idle read/write timeout
-p, --source-port port Specify source port to use
-s, --source addr Specify source address to use (doesn?t affect -l)
-l, --listen Bind and listen for incoming connections
-k, --keep-open Accept multiple connections in listen mode
-n, --nodns Do not resolve hostnames via DNS
-t, --telnet Answer Telnet negotiations
-u, --udp Use UDP instead of default TCP
--sctp Use SCTP instead of default TCP
-v, --verbose Set verbosity level (can be used up to 3 times)
-w, --wait <time> Connect timeout
--send-only Only send data, ignoring received; quit on EOF
--recv-only Only receive data, never send anything
--version Display Ncat?s version information and exit
See the ncat(1) manpage for full options, descriptions and usage examples
When passing a host parameter to Ncat, the simplest case is just to
list a single hostname or IP address. If you are supplying a range of
hosts, such as with --deny or --allow options, you can denote the
chosen range of IP addresses by appending the CIDR-style ?/mask? to the
IP address. The mask must be between zero (select the whole subnet) and
32 (scan the single host specified). For example, you may use /24 to
scan a class C subnet and /16 for a class B.
-4 (IPv4 only) .
Force the use of IPv4 only (default).
-6 (IPv6 only) .
Force the use of IPv6 only.
-u, --udp (Use UDP) .
Use UDP for the connection (the default is TCP).
--sctp (Use SCTP) .
Use SCTP for the connection (the default is TCP). SCTP support is
implemented in TCP compatible mode.
-g hop1[,hop2,...] (Loose source routing) .
Sets hops for IPv4 loose source routing. You can use -g once with a
comma-separated list of hops, use -g multiple times with single
hops to build the list, or combine the two. Hops can be given as IP
addresses or hostnames.
-G ptr (Set source routing pointer) .
Sets the IPv4 source route "pointer" for use with -g. The argument
must be a multiple of four and no more than 28. Not all operating
systems support setting this pointer to anything other than four.
-p port, --source-port port (Specify source port) .
Set the port number for Ncat to bind to.
-s host, --source host (Specify source address) .
Set the address for Ncat to bind to.
See the Access Control section for information on limiting which hosts
can connect to the listening Ncat process.
also means that it will never close its output stream, so any
program reading from Ncat and looking for end-of-file will also
--broker (Connection brokering) .
Allow multiple parties to connect to a centralised Ncat server and
communicate with each other. Ncat can broker communication between
systems that are behind a NAT or otherwise unable to directly
connect. This option is used in conjunction with --listen, which
causes the --listen port to have broker mode enabled.
--chat (Ad-hoc "chat server") .
The --chat option enables chat mode, intended for the exchange of
text between several users. In chat mode, connection brokering is
turned on. Ncat prefixes each message received with an ID before
relaying it to the other connections. The ID is unique for each
connected client. This helps distinguish who sent what.
Additionally, non-printing characters such as control characters
are escaped to keep them from doing damage to a terminal.
--ssl (Use SSL) .
In client-mode Ncat, this option transparently negotiates an SSL
session with an SSL server to securely encrypt the connection. This
is particularly handy for talking to SSL enabled HTTP servers, etc.
In server-mode Ncat, this option listens for incoming SSL
connections, rather than plain untunneled traffic.
--ssl-verify (Verify server certificates) .
In client mode, --ssl-verify is like --ssl except that it also
requires verification of the server certificate. Ncat comes with a
default set of trusted certificates. Some operating systems provide
a default list of trusted certificates; these will also be used if
available. Use --ssl-trustfile to give a custom list. Use -v one or
more times to get details about verification failures.
This option has no effect in server mode.
--ssl-cert certfile.pem (Specify SSL certificate) .
This option gives the location of a PEM-encoded certificate files
used to authenticate the server (in listen mode) or the client (in
connect mode). Use it in combination with --ssl-key.
--ssl-key keyfile.pem (Specify SSL private key) .
This option gives the location of the PEM-encoded private key file
that goes with the certificate named with --ssl-cert.
--ssl-trustfile cert.pem (List trusted certificates) .
This option sets a list of certificates that are trusted for
purposes of certificate verification. It has no effect unless
combined with --ssl-verify. The argument to this option is the name
If the proxy requires authentication, --proxy-auth is available.
--proxy-type proto (Specify proxy protocol) .
In client-mode, this option requests using proxy protocol proto to
connect through the proxy host specified by --proxy. In
server-mode, this option requests Ncat to actually act as a proxy
server using the specified protocol.
The currently available protocols in client-mode are "http"
(CONNECT) and "socks4" (SOCKSv4). The only server currently
supported is "http".
If this option is not used, the default protocol is http.
--proxy-auth user[:pass] (Specify proxy credentials) .
Used to specify proxy authentication credentials for client-mode.
For use with --proxy-type http, the form should be user:pass. For
--proxy-type socks4, it should just be a username.
COMMAND EXECUTION OPTIONS
-e command, --exec command (Execute command) .
Execute the specified command after a connection has been
established. The command must be specified as a full pathname. All
input from the remote client will be sent to the application and
responses sent back to the remote client over the socket. Thus,
effectively instantly making your application interactive over a
socket. Ncat will handle multiple simultaneous connections to your
specified port/application rather like inetd does. Ncat will only
accept a maximum, definable, number of simultaneous connections. By
default this is set to 100.
-c command, --sh-exec command (Execute command via sh) .
Same as -e, except it tries to execute the command via /bin/sh (so
you don?t have to specify the full path for the command).
ACCESS CONTROL OPTIONS
--allow host[,host,...] (Allow connections) .
The list of hosts specified will be the only hosts allowed to
connect to the Ncat process. All other connection attempts will be
silently dropped. Host specifications follow the same syntax used
--allowfile file (Allow connections from file) .
This has the same functionality as --allow, except that the allowed
hosts are provided in a new-line delimited allow file, rather than
directly on the command line.
--deny host[,host,...] (Deny connections) .
Issue Ncat with a list of hosts that will not be allowed to connect
to the listening Ncat process. Specified hosts will have their
session silently terminated if they try to connect. The syntax for
number of lines that Ncat will send in the specified period. This
may be useful for low bandwidth sites, or have other uses such as
annoying iptables --limit options.
-i time, --idle-timeout time (Specify idle timeout) .
Set a fixed timeout for idle connections. If the idle timeout is
reached, the connection is terminated.
-w time, --wait time (Specify connect timeout) .
Set a fixed timeout for connection attempts.
-o file, --output file (Save session data) .
Dump session data to a file
-x file, --hex-dump file (Save session data in hex) .
Dump session data in hex to a file. This can be used to "replay"
-v, --verbose (Verbosity) .
Issue Ncat with -v and it will be verbose and display all kinds of
useful connection based information. If you issue this twice (-vv)
then you will get all the code debugging information. Issue it
three times (-vvv) and you get the connection information and the
code debugging information.
-C, --crlf (Use CRLF as EOL) .
This option tells Ncat to try to use CRLF for line-endings if only
an LF is found. This doesn?t convert all LFs to CRLFs, only if it?s
at the end of the read buffer. This is useful for talking to some
stringent servers directly from a terminal in one of the many
common plain-text protocols which specify CRLF as the required EOL
-h, --help (Help screen) .
Displays a short help screen with common options and parameters,
and then exits.
--recv-only (Only receive data) .
If this option is passed, Ncat will only receive data and will not
try to send anything.
--send-only (Only send data) .
If this option is passed, then Ncat will only send data and will
ignore anything received. This option also causes Ncat to close the
network connection and terminate after EOF is received on standard
-t, --telnet (Answer Telnet negotiations) .
Handle DO/DONT WILL/WONT Telnet negotiations. This makes it
possible to script Telnet sessions with Ncat.
Redirect TCP port 8080 on the local machine to host example.org on port
ncat --sh-exec "ncat example.org 80" -l 8080
Bind to TCP port 8081 and attach /bin/bash for the world to access
ncat --exec "/bin/bash" -l 8081
Bind a shell to TCP port 8081, limit access to hosts on a local network
and limit the maximum number of simultaneous connections to three
ncat --exec "/bin/bash" --max-conns 3 --allow 192.168.0.0/24 -l 8081
Connect to a SOCKS4 server on port 1080
ncat --proxy socks4host --proxy-type socks4 --proxy-auth user smtphost
Create an HTTP proxy server on localhost port 8888
ncat -l --proxy-type http localhost 8888
Send a file over TCP port 9899 from HOST2 (client) to HOST1 (server)
HOST1$ ncat -l 9899 >outputfile
HOST2$ ncat HOST1 9899 <inputfile
Transfer in the other direction, turning Ncat into a "one file" server
HOST1$ ncat -l 9899 <inputfile
HOST2$ ncat HOST1 9899 >outputfile
The exit code reflects whether a connection was made and completed
successfully. 0 means there was no error. 1 means there was a network
error of some kind, for example "Connection refused" or "Connection
reset". 2 is reserved for all other errors, like an invalid option or a
Like its author, Ncat isn?t perfect. But you can help make it better by
sending bug reports or even writing patches. If Ncat doesn?t behave the
way you expect, first upgrade to the latest version available from
http://nmap.org. If the problem persists, do some research to determine
whether it has already been discovered and addressed. Try Googling the
error message or browsing the nmap-dev archives at
http://seclists.org/. Read this full manual page as well. If nothing
comes of this, mail a bug report to email@example.com. Please
Kris Katterjohn firstname.lastname@example.org
Fyodor email@example.com (http://insecure.org)
The original Netcat was written by *Hobbit* firstname.lastname@example.org. While
Ncat isn?t built on any code from the "traditional" Netcat (or any
other implementation), Ncat is most definitely based on Netcat in
spirit and functionality.
Ncat 01/26/2010 NCAT(1)