Book Image

Instant Netcat Starter

By : Kenneth Curtis Yerrid
1 (1)
Book Image

Instant Netcat Starter

1 (1)
By: Kenneth Curtis Yerrid

Overview of this book

As a featured networking utility, Netcat uses TCP/IP protocols to read and write data across network connections. Netcat is a feature rich backend network debugging and exploration tool with the ability to create almost any type of connection you would need. "Instant Netcat Starter" is a practical, hands-on guide that provides you with a simple and straightforward roadmap to proceed from newbie to seasoned professional with the Netcat utility. By progressing from simple to more complex uses, this book will inform and explain many of the primary use cases that are only limited by your imagination.This book explores the classic Netcat utility, and breaks down the common ways in which it can be utilized in the field. Beginning with compilation and installation, this book quickly has you utilizing the core features of the utility to perform file transfers regardless of commonly blocked firewall ports, perform real-world interrogation of services and listening ports to discover the true intention of an application or service, and tunnelling remotely into systems to produce remote command shells.
Table of Contents (8 chapters)

So, what is Netcat?


Every once in a while, someone stumbles upon a classic item that has been discovered in pristine condition, despite being under a dust cloth, or in a relative's attic for years. Perhaps it is a 1952 Mickey Mantle rookie baseball card (minus the gum, of course), or an old version of the Action Comics #1 comic book (Superman's debut for the uninitiated). In the information security and network operations world, one of those gems is the classic utility Netcat.

Initially released in 1995, Netcat has survived and continues to thrive despite its age and relative simplicity. According to SecTools.org, Netcat is ranked as the eighth favorite network security tool (Nmap Security Scanner Project, 2011). While many ports and variations have emerged based on the classic utility, Netcat is still available in its original form from various websites.

At its most basic interpretation, Netcat establishes a connection between two computers and allows data to be written across the TCP and UDP transport layer protocols, and the network layer protocol IP. For those familiar with Unix and Linux distributions, the name is most likely the derivative of the classic command cat, with networking capabilities thrown in for added utility. Given the variety of tasks and scenarios that Netcat has been able to accomplish for its operators, it is no wonder that most references to the utility call it the Swiss Army knife for TCP/IP communications (Netcat). However, in reality, Netcat solves problems more in line with the type of problems that a roll of duct tape can solve.

At the core of the functionality, Netcat operates in one of the two basic modes. As a client, Netcat operates with the express purpose of initiating a connection to another computer (or the same computer; more on this in a bit). Conversely, the same Netcat binary operates in a server or listener mode when specific parameters are passed to the utility. These options are described in the output in the following lines (also shown in the next screenshot):

connect to somewhere: nc [-options] hostname port[s] [ports]
listen for inbound: nc -l -p port [options] [hostname] [port]

Netcat for Windows with options listed

Common uses for Netcat

Netcat is a flexible and lightweight utility that can be used in a variety of scenarios. In this section, I will cover some of the more common uses and, in later sections, I will cover some of the more exotic uses.

  • Chat/Messaging Server: By using Netcat, an operator can redirect simple text between two computers in a simplistic chat or in an instant message interface.

  • File Transfers: Netcat allows you to transfer files between computers without the need to install a full-blown FTP server.

  • Banner Grabbing: Netcat allows an operator to establish a socket to a specific port to potentially identify the operating system, service, version, and other tidbits of information necessary to enumerate the purpose and/or potential weaknesses in the service.

  • Port Scanning: Netcat allows the operator to utilize a rudimentary port scanning function, whereby a port or series of ports can be interrogated to determine if the port is open or closed.

Regardless of the need, there is probably a creative solution that Netcat can help fulfill for its operator. With this in mind, let's dive into the meat and potatoes of this utility by downloading and working with Netcat directly. We will look at getting you up and running with both the Unix/Linux and Windows versions of the utility. Let's go!