Today we are going to create static .exe binaries for netcat.

While there are many ports and reimplementations of netcat, we are going to stick with win32 ports for netcat 1.11 or netcat 1.12 (the latter one enables sending CRLF line endings instead of CR using command line option -c).

We will use MXE as our cross-compilation environment. Compile the cc package as described in the tutorial. Add the directory with cross-compilers to your PATH.

Then download and unpack the source from the win32 ports above and issue the following commands:

i686-w64-mingw32.static-gcc -DNDEBUG -DWIN32 -D_CONSOLE -DTELNET -DGAPING_SECURITY_HOLE  getopt.c doexec.c netcat.c -O2 -s -static -lkernel32 -luser32 -lwsock32 -lwinmm -o nc.exe

and

x86_64-w64-mingw32.static-gcc -DNDEBUG -DWIN32 -D_CONSOLE -DTELNET -DGAPING_SECURITY_HOLE  getopt.c doexec.c netcat.c -O2 -s -static -lkernel32 -luser32 -lwsock32 -lwinmm -o nc64.exe

to compile the 32-bit and 64-bit version respectively.

I compiled netcat 1.12 for you and placed it into a Dropbox folder.

If you decide to use them, here are the MD5 checksums:

f630164e41932360440f43602f670d21  nc64.exe
bc3029d3e79265f9ab2e906009adb196  nc.exe

Here is the list with the netcat tutorials: