Encrypted Data Transfer Using Cryptcat

If you like Netcat but don't want to use it because it offers no encryption you should take a look at Cryptcat, It allows the functionality of netcat, but uses twofish encryption to encrypt the data. In this post, we explain how to use Cryptcat

Introducing Cryptcat

Cryptcat can be used as an alternative to ssh when you just want to hide your data from potential packet sniffers on the network and are not too worried about other aspects of security.

The main difference between Cryptcat and Netcat as far as usage is concerned, is that you must supply a password to Cryptcat. It takes this password and uses it as a salt to encrypt the data being sent.

Be sure to supply a password to cryptcat, otherwise the connection will be encrypted using the default which everyone will obviously have access to.

Note that as with our Netcat examples, the port numbers used are arbitrary. Only the super user can use port numbers below 1024. Also check that the ports are not being blocked by your firewall.

Basic Chat Server with Encryption

On the server side, set up cryptcat to listen for connections on port 3333

cryptcat -k mysecret -l -p 3333
On the client side connect using:
cryptcat -k mysecret <server-ip-address> 3333
e.g.
cryptcat -k mysecret 192.168.0.17 3333

Note that the -p to specify the listening port is required with cryptcat but not with netcat (nc).
Be sure to pick a more suitable password as mysecret could easily be guessed!

Basic telnet emulation with encryption

To run commands on another machine over a cryptcat secured connection do the following:
Make a FIFO:

mkfifo myfifo
On the server side where you want to run the commands run:
cryptcat -k mysecret -l -p 3333 0<myfifo | /bin/bash 1>myfifo
Then connect from another box using:
cryptcat -k mysecret <server-ip-address> 3333
Now any commands entered on the client side are executed over an encrypted connection on the server with the results being sent back to the clients shell.

Thanks to farm9, Dan F, Jeff Nathan, Matt W, Frank Knobbe, Dragos, Bill Weiss, and Jimmy for their work in implementing cryptcat.