© Dmitry Rukhlenko, 123RF.com
Netcat – The admin's best friend
Utile
With the seemingly unlimited number of Linux packages that are available today, sometimes it's easy to become distracted and miss out on the really high-quality packages – those that offer the most impressive functionality. I'm sure you could name a few ubiquitous networking packages that the majority of admins might have used in the past. I'm thinking, for example, about userland packages like ngrep, IPTraf, Tcpdump, Nmap, and iftop.
As well as these tools, however, you almost certainly will have encountered the relatively famous Netcat. Among its formidable feature set, the fantastic Netcat can be a random port-scanning hacking tool, a whitehat security tool, and a server or a client; it performs monitoring, supports tunneling, and is a simple TCP proxy server on top of that! Hard to believe, I realize, but in this article, I'll take a more detailed look at what the venerable Netcat can do.
First Things First
Netcat [1] has been around for a long time, and it's been able to do all sorts of things relating to TCP and UDP since its inception. These days, it handles IPv6 as well as IPv4 beautifully. Its astounding versatility means that integrating it with scripts is a veritable piece of cake. I have heard it said in fact that Netcat actually comes with too many features; however with a minuscule installation footprint, there's surely not much cause for complaint.
One tool that many admins have put to use in the past to test open ports is the widely used Telnet client.
For example, if you were opening a web page to test an HTTP server, you could use something along the lines of:
# telnet remotehost.tld 80
Once a connection is established, you could pull the page content down with a GET (there's no prompt inside the Telnet session):
GET /
This is a
...Buy this article as PDF
(incl. VAT)
