Main Content

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.

C:Windowsnc111nt

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]
options:
        -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 192.168.1.10 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.

Links:

Comments

  1. Commented on
    Comment by sphinx

    The virus scanner is reporting that this is infected

    1. Commented on
      Comment by Luis Ventura

      Using Symantec maybe?, don’t worry the file itself is not malware. Netcat is a network security tool that can be used for good like this post suggest or to permit authorized access.

    2. Commented on
      Comment by ImaDex

      Look up what that “infection” is, it will in fact just be warning the user that this is a security analysis tool that should only be in the hands of the right users not average system users on say a corporate network, and placed on your network against your will or knowledge and/or in the wrong hands it IS dangerous (see the “-e” argument for example)

      I assure you netcat is a brilliant piece of clean code and if you were running anything but windows or a slightly better virus scanner you’d be having a great time with it 😛

Comments are closed.