Netcat for Windows

Running Netcat in Windows is easier than I tough, the entire process consists of downloading a single .zip file named nc111nt.zip from here or from the local mirror here. Wikipedia has a nice entry with examples on Netcat.

How To

Unzip the file and move the resulting folder to a location where you can access it, for example.


Open a command line window and move to the location where nc111nt is located by using the command cd.

cd C:Windowsnc111nt

To run Netcat you need to type.

C:Windowsnc111ntnc.exe [parameter]

To view a list of available parameters type.

C:UsersLuisDownloadsnc111nt>nc.exe -help
[v1.11 NT www.vulnwatch.org/netcat/\]
connect to somewhere: nc [-options] hostname port[s] [ports] …
listen for inbound: nc -l -p port [options] [hostname] [port]
-d detach from console, background mode

    -e prog         inbound program to exec \[dangerous!!\]
    -g gateway      source-routing hop point\[s\], up to 8
    -G num          source-routing pointer: 4, 8, 12, ...
    -h              this cruft
    -i secs         delay interval for lines sent, ports scanned
    -l              listen mode, for inbound connects
    -L              listen harder, re-listen on socket close
    -n              numeric-only IP addresses, no DNS
    -o file         hex dump of traffic
    -p port         local port number
    -r              randomize local and remote ports
    -s addr         local source address
    -t              answer TELNET negotiation
    -u              UDP mode
    -v              verbose \[use twice to be more verbose\]
    -w secs         timeout for connects and final net reads
    -z              zero-I/O mode \[used for scanning\]

port numbers can be individual or ranges: m-n [inclusive]

Real Worl Example:

Netcat is possible of many things, but my favorite use is to transfer disk images created with dd over the network. As an example I am going to image a 4GB CF card over a gigabit network(no compression). The concept of sender and receiver will be used. System where the image will be stored:

nc –l –p 7000 | dd of=/dev/hda

Source system:

dd if=/dev/hda | nc 4000

Not many things are this easy to run and use, but the nice thing about Netcat is that it works regardless of the operating system being used. Like said I mostly use it to transfer the images I create with the help of dd (Parted Magic) over to my Windows server.

, , — May 15, 2011