NetCat in Excel

Netcat is a super useful network utility available as a command-line program on Unix (and ported to lots of other platforms including Windows). It allows you to open a network connection interactively, or to pipe the input/output of another program to a network socket.

Because of it’s versatility, it is much loved as a troubleshooting tool by sysadmins. It does have a dark side, however. If you work in a corporate environment you may find the Windows version of netcat blocked by popular enterprise security software (netcat is just as useful to malicious network explorers). So, what’s a locked-down sysadmin to do?

Port netcat to Microsoft Excel, of course!

The real crux of the matter is importing Windows WinSock functions and defining the WinSock constants and data structures  into the MS Office VBA environment. Once that is sorted out, it’s pretty quick to cobble together a user interface to allow the user to initiate a connection and to send/receive data.

Here are some screenshots of ExcelNetCat in action:


Check out the full source code on pastebin.