From ef96e1b9da42ca9c17cb5d58b93332468e207971 Mon Sep 17 00:00:00 2001 From: webbreacher Date: Tue, 17 Dec 2013 20:39:12 -0500 Subject: [PATCH 1/2] Adding ncat content --- cats/ncat.md | 23 +++++++++++++++++++++++ navigation.md | 1 + 2 files changed, 24 insertions(+) create mode 100755 cats/ncat.md diff --git a/cats/ncat.md b/cats/ncat.md new file mode 100755 index 0000000..ea94333 --- /dev/null +++ b/cats/ncat.md @@ -0,0 +1,23 @@ +# Ncat Usage + +`ncat` similar to the venerable `netcat`, is a command-line or shell application that can be used for a wide variety of exploitation matters including transferring files, establishing remote shells and more! The official ncat site is http://nmap.org/ncat/. + +The examples below are mostly copied from the http://nmap.org/book/ncat-man-examples.html page or http://www.irongeek.com/i.php?page=videos/ncat-nmap-netcat and are not a complete listing of all the examples. + +## Commands +| Command | Description / Importance | +| -------- | ------------------------ | +| `ncat example.org 8080` | Connect to example.org on TCP port 8080. | +| `ncat -l 8080` | Listen for connections on TCP port 8080. | +| `ncat --sh-exec "ncat example.org 80" -l 8080 --keep-open` | Redirect TCP port 8080 on the local machine to host on port 80. | +| `ncat --exec "/bin/bash" -l 8081 --keep-open` | Bind to TCP port 8081 and attach /bin/bash for the world to access freely. | +| `ncat --exec "/bin/bash" --max-conns 3 --allow \`
`192.168.0.0/24 -l 8081 --keep-open` | Bind a shell to TCP port 8081, limit access to hosts on a local network, and limit the maximum number of simultaneous connections to 3. | +| `ncat -l --proxy-type http localhost 8888` | Create an HTTP proxy server on localhost port 8888. | +| `HOST1: ncat -l 9899 > outputfile`
`HOST2: ncat HOST1 9899 < inputfile` | Send a file over TCP port 9899 from host2 (client) to host1 (server). | +| `HOST1: ncat -l 9899 < inputfile`
`HOST2: ncat HOST1 9899 > outputfile` | Transfer in the other direction, turning Ncat into a "one file" server. | +| `echo -e "GET / HTTP/1.0\n\n"`|`ncat google.com 80` | Retrieve the HTML source code of the web server at google.com on TCP port 80. | +| `ncat -t example.org 23` | Connect to example.org's telnet server on TCP port 23. | +| `Server: ncat -l 74 --udp`
`Client: ncat --udp localhost 74 < inputfile` | Transfer file from client to server over UDP. | +| `Server: ncat -l 74 --chat`
`Client1: ncat localhost 74`
`Client2: ncat localhost 74`| Simple chat. | +| `Server: ncat -l --ssl 74 --send-only < inputfile`
`Client: ncat localhost 74 --ssl > outputfile` | Transfer file from server to client using SSL encryption. | +| `ncat -l localhost 80 --sh-exec "ncat google.com 80 -o text.txt -x hex.txt"` | Ncat relay | \ No newline at end of file diff --git a/navigation.md b/navigation.md index 6c4f199..746a3fc 100644 --- a/navigation.md +++ b/navigation.md @@ -57,6 +57,7 @@ [Cats]() + * [ncat](cats/ncat.md) * [netcat](cats/netcat.md) [Metasploit]() From e0f150628ac1ad86b0c2ef1d6f70d58e643fe86f Mon Sep 17 00:00:00 2001 From: webbreacher Date: Wed, 18 Dec 2013 16:54:31 -0500 Subject: [PATCH 2/2] Renamed HOST[12] to Server and Client appropriately and reworded comments for better reading. --- cats/ncat.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cats/ncat.md b/cats/ncat.md index ea94333..0d51943 100755 --- a/cats/ncat.md +++ b/cats/ncat.md @@ -13,8 +13,8 @@ The examples below are mostly copied from the http://nmap.org/book/ncat-man-exam | `ncat --exec "/bin/bash" -l 8081 --keep-open` | Bind to TCP port 8081 and attach /bin/bash for the world to access freely. | | `ncat --exec "/bin/bash" --max-conns 3 --allow \`
`192.168.0.0/24 -l 8081 --keep-open` | Bind a shell to TCP port 8081, limit access to hosts on a local network, and limit the maximum number of simultaneous connections to 3. | | `ncat -l --proxy-type http localhost 8888` | Create an HTTP proxy server on localhost port 8888. | -| `HOST1: ncat -l 9899 > outputfile`
`HOST2: ncat HOST1 9899 < inputfile` | Send a file over TCP port 9899 from host2 (client) to host1 (server). | -| `HOST1: ncat -l 9899 < inputfile`
`HOST2: ncat HOST1 9899 > outputfile` | Transfer in the other direction, turning Ncat into a "one file" server. | +| `Server: ncat ClientIP 9899 < inputfile`
`Client: ncat -l 9899 > outputfile` | Send a file over TCP port 9899 from Server to Client. Server "pushes" the file to the Client. | +| `Server: ncat -l 9899 < inputfile`
`Client: ncat ServerIP 9899 > outputfile` | Transfer in the other direction, turning Ncat into a "one file" server. Client "pulls" file from the Server. | | `echo -e "GET / HTTP/1.0\n\n"`|`ncat google.com 80` | Retrieve the HTML source code of the web server at google.com on TCP port 80. | | `ncat -t example.org 23` | Connect to example.org's telnet server on TCP port 23. | | `Server: ncat -l 74 --udp`
`Client: ncat --udp localhost 74 < inputfile` | Transfer file from client to server over UDP. |