Tuesday, November 8, 2011

Missing telnet on Windows? Try netcat.

Following command:


$ telnet www.google.com 80

tests, if you are able to connect to www.google.com server over TCP/IP on port 80.
If you see something like "Connection rejected" or "Unable to open connection", then you or Google have a problem, if you see some other message or prompt, waiting for your input, then you are lucky and can claim, that your connectivity to given service is working on the TCP/IP level.

Telnet used to be standard part of MS Windows installations for some time, but since Windows XP (if I remember well) it is either not installed by default (one had to go to Control Panels, Add Remove Programs, Add Removes System Components and hunt it somewhere there to enable it) or missing completely.

As telnet is typical tool to check connectivity to TCP/IP services over network, telnet can be often really missing tool.

But there is an easy solution for this - use netcat

Netcat is command which comes from Linux/Unix world and provides the same service as telnet and even more.
To use netcat (often available as nc command) in the telnet style, simply call:


$ nc www.google.com 80

or to get more verbose version of the call, ask it to be more verbose:


$ nc -vv www.google.com 80

To use it on Windows, you have to install it. Go to http://www.securityfocus.com/tools/139 and get the zip file from there.
It is enough to unzip it somewhere and call it from that directory. If you like, you can finetune it by adding it either to path, which is already included in PATH settings, or add the path of netcat to PATH.


If you want to get even more from netcat

Netcat can serve for even more sophisticated tests, e.g. providing simple way to start tcp server (and then you can try connecting from other place). See the wikipedia page, blog entry by Luke Maciak Few Useful Netcat Tricks, or ask Mr. Google and find some yourself.

No comments:

Post a Comment