Follow us on Twitter!
One mans freedom fighter, another's terrorist.
Friday, April 25, 2014
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Members Online
Total Online: 14
Guests Online: 14
Members Online: 0

Registered Members: 82908
Newest Member: krishna7799
Latest Articles

A ball of Wool and NetCat

Arrow Image A simple tutorial on NetCat, and some other things you can do with netcat

A ball of Wool and NetCat

In this article i will go over some basic netcat commands and will use netcat with other programs to closely replicate other tools/services.

NOTE to Windows users: netcat comes standard with most Unix based systems, it is not provided with Windows. To download netcat for Windows, See Below.

The Basics
netcat is a TCP/UDP connection tool, it can be used to connect to other computers and can be used to allow other computers to connect to your host.

Example 1.1 - to connect to HBH\'s website, use the following command without quotes: \"nc 80\"
This will connect but will not return any data, to get HBH to return the index/home page type \"GET /\" with out the quotes and hit enter twice.
SYNTAX Extra: the -n option is needed to allow numeric addresses or ip addresses

Example 1.2 - to create and open port on you localhost, use the following command without quotes: \"nc -l -p 2345\"
This will open port 2345 on your machine, you can connect to this port with the command from Example 1.1 (nc localhost 2345). You may wonder why I used port 2345, on Unix based systems ports 1-1024 can only be opened by root, where as ports above 1024 can be opened by normal users. Connecting to the port with the example above will not return any results, you can use CTRL+C to exit.
SYNTAX Extra: -l tells netcat to listen, -p is needed to assign a port number.

Simple Private Chat
You may have noticed in the above example, if you type something in the terminal and hit enter, it gets echoed to the terminal listening for connections and the terminal connecting. This is a very simple way to setup a private chat session with your friends whether they are on your local LAN or on the Internet. Your friends don\'t need to have netcat to connect to your host, they can use telnet.

Simple File Transfer
To send a file across a network with netcat, you can use the command in Example 1.2 with a little extra sugar.
Example 2.1: nc -l -p 2345 < newhbhchallengecode
Explanation: Using Example 1.2 you create an open port, then using the redirection operator \"<\" newhbhchallengecode is send to port 2345.
Example 2.2: cat newhbhchallengecode | nc -l -p 2345
Explanation: Using Example 1.2 you create an open port, then using the pipe operator \"|\" newhbhchallengecode is send to port 2345.

NOTE: Windows does not have the cat command, you will have to use the type command.

NOTE: You may think that straight after you hit enter, your command will start sending the data to the port, but netcat will wait until a connection is established before sending the data to the port.

To retrieve the data you can either use telnet or Example 1.1 with the redirection operator \">\" and a filename. The filename can be anything you choose.
Example 2.3: telnet localhost 2345 > hbhnewchallengecode
Example 2.4: nc localhost 2345 > xyz

NOTE: The same above commands can be used to create a webserver, or bulletin board, or news server that serves one page.

NOTE: netcat will close after the first connection is completed, to keep netcat running you will have to create a program that loops the command. That is out side the scope of the article, and i don\'t feel like giving an example in C,Perl,Python and PHP.

Adding some security
Using OpenSSL you can encrypt your connections that only people with the correct password can access the data on the port. This can be used on all of the above Examples.

NOTE: BOTH host must have OpenSSL or an Equivalent Program.

Example 3.1: openssl enc -aes-128-cbc | nc -l -p 2345
SYNTAX: openssl enc {-CIPHER}
Example 3.2: openssl enc -aes-128-cbc -in hbhsecretcode | nc -l -p 2345
SYNTAX: openssl enc {-CIPHER} -in {FILE TO ENCRYPT}

Connecting, and Retrieving
Example 3.3: nc localhost 2345 | openssl enc -d -aes-128-cbc
Example 3.4: nc localhost 2345 | openssl enc -d -aes-128-cbc -out hbhsecretcode
Explanation: Giving OpenSSL -d will tell it to decrypt the data

Example 3.1 is Example 1.2 with encryption, and can also be used for private chat. Example 3.2 is Example 2.1 with encryption and can be used in the same way as you would use Example 2.1. You can add -a to the end of the openssl command (before the piping \'|\' operator) to add base64 encoding. Remember if you encrypt it a certain way you need to decrypt it the same way.

If you don\'t know what cipher commands you can use, the command below will display OpenSSL\'s options.
Example 3.5: openssl -

NOTE: All Commands can be used to listen or connect to a UDP port, by adding the -u to each netcat command. Keep in mind that telnet cannot connect to UDP ports.

Exercise: NetCat can also be used to setup telnet server, but i will leave that for you to figure out.

NetCat Manual: man netcat (Unix Only)

Download NetCat @


system_meltdownon August 14 2008 - 02:48:24 Smile
spywareon August 14 2008 - 08:54:38 Smile
korgon August 14 2008 - 10:28:11
http://will.hughe. . .eewifi.jpg
korgon August 14 2008 - 10:28:24
http://will.hughe. . .eewifi.jpg
korgon August 14 2008 - 10:29:26
Goddamn internet hung on me, Sorry for double link.
Uber0non August 16 2008 - 19:24:16
@korg: Thanks for triple post Grin (jk)
japanesedudeon August 17 2008 - 17:47:12
Net cat is neeeeeeeeeeett!
korgon August 19 2008 - 09:07:21
@Uber0n Technically it's only a double post. The last one is me bitching.
Zephyr_Pureon August 25 2008 - 07:00:38
Post Comment


You must have completed the challenge Basic 1 and have 100 points or more, to be able to post.