Learn the many uses of netcat
Takeaway: The netcat tool allows admins to read and write TCP or UDP data across the network. It also helps with network debugging and testing. Learn more about netcat.
Delivered each Tuesday, TechRepublic's free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!
Often referred to as the "Swiss Army Knife of networking," netcat is a tool that administrators can use to read and write TCP or UDP data across the network. In addition, it's extremely useful for network debugging and testing.Netcat offers several interesting uses. For example, you can make it listen to a particular port and run a program. To do so, use the following:
$ netcat -v -l -p 10111 -e "/bin/cat /etc/motd"
This tells netcat to listen to port 10111. When there's a connection, it tells netcat to execute "/bin/cat /etc/motd," which essentially displays the contents of /etc/motd and exits.
You can also set up netcat on a machine to listen for incoming connections and run it on a remote machine to connect to the local machine and serve up a bash shell. For example, on a local machine with an IP address of 192.168.5.10, you would use the following:
$ netcat -v -l -p 10111
On the remote machine, you would use:
$ netcat 192.168.5.10 10111 -e /bin/bash
This tells the netcat instance on the remote machine to connect to the netcat instance listening on 192.168.5.10 and serve up a bash shell from the remote machine, which will then be available on the local machine. Using the netcat instance on 192.168.5.10, you can execute shell commands on the remote host.
To perform some Web debugging, you could use something like the following:
$ netcat www.website.com 80
Then, enter typical HTTP commands to get the unaltered output (e.g., "GET / HTTP 1.0").
As you can see, netcat is both an extremely versatile and very powerful utility. You can download this useful tool, based on the original netcat program, from the GNU Netcat Project Web site.
Print/View all Posts Comments on this article
|
|
|
|
White Papers, Webcasts, and Downloads
- VMware Infrastructure: A Guide to Bottom-Line Benefits VMware Frustrated by the high cost of maintaining or building ever-larger data centers? Get the facts you need to formulate your Virtualization Action Plan. Download Now
- Dell Helps Medical University of South Carolina Bring the Intelligent Classroom to Life Dell Established in 1824, Medical University of South Carolina (MUSC) is one of ... Download Now
- Five Steps to Determine When to Virtualize YourServers VMware Thinking of virtualizing the servers at your company? Use this step-by-step guide to determine when's the best time to make your big move. Download Now
- Why Isn't Server Virtualization Saving Us More? A Few Small Changes May Dramatically Increase Your Efficiency VMware Ever wonder why your company isn't saving more from its server virtualization? Making a few small changes could dramatically increase your efficiency. Download Now
- Building the Virtualized Enterprise with VMware Iinfrastructure VMware VMware virtualization software has been adopted by over 120,000 enterprise ... Download Now
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET





