| 1 |
. . |
| 2 |
\`-"'"-'/ |
| 3 |
} 6 6 { |
| 4 |
==. Y ,== |
| 5 |
/^^^\ . |
| 6 |
/ \ ) |
| 7 |
( )-( )/ _ |
| 8 |
-""---""--- / |
| 9 |
/ Ncat \_/ |
| 10 |
( ____ |
| 11 |
\_.=|____E |
| 12 |
|
| 13 |
|
| 14 |
README for Ncat |
| 15 |
--------------- |
| 16 |
|
| 17 |
Ncat is a reimplementation of the currently splintered and reasonably |
| 18 |
unmaintained Netcat family. Ncat will do pretty much everything that |
| 19 |
all the other Netcat's do, all in one place. Plus it has the added |
| 20 |
benefit of spanky new features and ongoing development. |
| 21 |
|
| 22 |
Ncat was designed with the original Netcat interface in mind. Rather |
| 23 |
than replacing the old Netcat interface with a brand new (and thus more |
| 24 |
convoluted) set of options, the Ncat interface was intentionally kept |
| 25 |
clean and simple to use, just like the original product. |
| 26 |
|
| 27 |
Ncat provides most of the features present in the original Netcat but with |
| 28 |
a complete overhaul and rewrite, along with completely new features and a |
| 29 |
combination of other well received features of other Netcat products, such |
| 30 |
as IPv6 and SSL support. |
| 31 |
|
| 32 |
The port scanning support has been entirely removed from Ncat. The |
| 33 |
reason for this is fairly obvious: there is a better port scanner out |
| 34 |
there already... :) |
| 35 |
|
| 36 |
Ncat can act as either a client or server, using TCP or UDP over IPv4 or |
| 37 |
IPv6. SSL support is provided for both the client and server mode. |
| 38 |
|
| 39 |
There is also a new "connection brokering" feature which enables two or |
| 40 |
more hosts to connect that previously were unable to directly communicate |
| 41 |
with each other. |
| 42 |
|
| 43 |
For example: "Host A" can connect to "Host B" but not "Host C" |
| 44 |
"Host C" can connect to "Host B" but not "Host A" |
| 45 |
|
| 46 |
It is clear, then, that if you could connect to "Host B" then "Host A" |
| 47 |
and "Host C" could directly communicate... |
| 48 |
|
| 49 |
[HostA] <------> [HostB-with-Ncat-Broker] <------> [HostC] |
| 50 |
|
| 51 |
Ncat's connection brokering will allow you to connect between Host A and |
| 52 |
Host C via Host B without the trouble of having to have SOCKS support, |
| 53 |
etc. This is still somewhat experimental behaviour. |
| 54 |
|
| 55 |
Ncat has support for HTTP "CONNECT" via an HTTP proxy server such as Squid. |
| 56 |
It can also connect via a SOCKS4 server and is very flexible in terms of |
| 57 |
how it shuffles your data around. |
| 58 |
|
| 59 |
Ncat can also spawn its own HTTP CONNECT proxy server for your |
| 60 |
own relaying requirements. |
| 61 |
|
| 62 |
Ncat has the ability to execute a program and handle the I/O for its data |
| 63 |
over the socket. In other words, Ncat can "add" networking support to |
| 64 |
applications that currently have none. |
| 65 |
|
| 66 |
For example, you could: |
| 67 |
|
| 68 |
ncat --exec "/bin/bash" -l 5000 |
| 69 |
|
| 70 |
NOTE: This is exceptionally dangerous behaviour, as it leaves an open shell |
| 71 |
sitting directly accessible to anyone who is able to connect to port 5000. |
| 72 |
See the allow and deny options below for securing your Ncat processes. |
| 73 |
|
| 74 |
Ncat has a TCP and UDP "redir"-style redirection feature to allow the user |
| 75 |
to redirect traffic from one host to another. |
| 76 |
|
| 77 |
For example: |
| 78 |
|
| 79 |
ncat --exec "/usr/local/bin/ncat www.example.com 80" -l 8888 |
| 80 |
|
| 81 |
This command binds Ncat to the local machine on port 8888 and redirects |
| 82 |
connections to www.example.com. You may also find uses for this as a "host |
| 83 |
hiding" system. Similar to SOCKS4 but without any of the hassle of having |
| 84 |
to have SOCKS support in the application. |
| 85 |
|
| 86 |
This also begs the question of, "What would happen if you decided you wanted |
| 87 |
to pass the --udp flag in to the above command somewhere?" |
| 88 |
|
| 89 |
In this case, you would have a TCP to UDP "gender changer". |
| 90 |
|
| 91 |
If you have an application that only makes only TCP connections, for example, |
| 92 |
you could spawn a Ncat process to listen on a the applications TCP port and |
| 93 |
then redirect the TCP connection out to the final destination, only over UDP. |
| 94 |
|
| 95 |
The --allow and --deny options are provided to prevent unauthorized access to |
| 96 |
any Ncat process that is listening on a port. These options are also paired |
| 97 |
with the --allowfile and --denyfile options, similar in behaviour to Nmap. |
| 98 |
|
| 99 |
The allow and deny options accept a number of different IP address formats |
| 100 |
for maximum flexibility: |
| 101 |
|
| 102 |
A single IP address, of the format: |
| 103 |
|
| 104 |
ip.ip.ip.ip |
| 105 |
|
| 106 |
EG: 192.168.10.1 |
| 107 |
|
| 108 |
A CIDR-style IP address range, of the format: |
| 109 |
|
| 110 |
ip.ip.ip.ip/cidr |
| 111 |
|
| 112 |
EG: 192.168.10.0/24 |
| 113 |
|
| 114 |
An IP and full netmask, of the format: |
| 115 |
|
| 116 |
ip.ip.ip.ip:nm.nm.nm.nm |
| 117 |
|
| 118 |
EG: 192.168.10.4:255.255.255.255 |
| 119 |
|
| 120 |
An IP address with wildcards: |
| 121 |
|
| 122 |
ip.ip.ip.* |
| 123 |
ip.ip.*.* |
| 124 |
ip.*.*.* |
| 125 |
|
| 126 |
These rules may also be used in a flat file, delimited by newlines. An |
| 127 |
example of a full ACL is included in docs/examples/ labelled 'iplist'. Also |
| 128 |
note that comments start with a # and are perfectly acceptable for use in |
| 129 |
the ACL's. |
| 130 |
|
| 131 |
For example, the file "ipaccess" might look like: |
| 132 |
|
| 133 |
# Abuse from ADSL user. |
| 134 |
88.223.14.1/32 |
| 135 |
|
| 136 |
# This guy is scanning us for SOCKS4 servers to abuse, block his /24 |
| 137 |
194.213.167.* |
| 138 |
|
| 139 |
To implement this IP address ACL simply run: |
| 140 |
|
| 141 |
ncat --denyfile /path/to/file/ipaccess -l 7000 |
| 142 |
|
| 143 |
For further documentation, please see the man page. |
| 144 |
|
| 145 |
--Chris Gibson and Kris Katterjohn |
| 146 |
|