Search This Blog

2014-10-08

NetCat In Windows

In the unix world there is a utility called
nc
that allows you to send data through a socket to communicate with a remote device listening on that socket.

In windows there is a way to emulate that using netcat for windows included in the nmap suite. It can be downloaded here http://nmap.org/download.html and once downloaded there will be an executable that exists in:
C:\Program Files (x86)\Nmap\ncat.exe
that you can execute to perform operations as you would normally with
nc
in unix.

The cool thing is, that with powershell, you are still able to "pipe" output to netcat.exe as you would in unix.

The following is an example of how to use ncat in Windows to send a message to a remote server
Write "Message Text" | & "C:\Program Files (x86)\Nmap\ncat.exe" $ServerName $Port
Where $ServerName is the remote server you wish to communicate with and $Port is the remote port the server is listening on.

In PowerShell if running a full path it is required to run with an & at that start.

References: http://serverfault.com/questions/629682/send-text-string-to-a-socket-in-windows

No comments:

Post a Comment