# Netcat

### Basic Usage

```css
nc [options] [hostname/IP] [port]
```

```
nc example.com 80
```

Send and receive files

```css
nc -l [port] < file_to_send
nc [server_IP] [port] > received_file
```

Port scanning

<pre class="language-css"><code class="lang-css">nc -zv [hostname/IP]<a data-footnote-ref href="#user-content-fn-1"> </a>[start_port]-[end_port]
</code></pre>

## How to extract files using netcat

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2Fe5vfzY7nO9L60okxD3d8%2Fimage.png?alt=media&#x26;token=67e585b1-3428-4656-80ab-544e4b3720a9" alt=""><figcaption><p>Set a Listener</p></figcaption></figure>

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2FX6K3KiHkrNH2xkeQimZY%2Fimage.png?alt=media&#x26;token=1152e338-c922-432b-852e-a7959a49c51a" alt=""><figcaption><p>Send the files</p></figcaption></figure>

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2FbQyQnpx10B9eTC2jqQBP%2Fimage.png?alt=media&#x26;token=fec8825d-669a-4b58-b361-5496ab6366f5" alt=""><figcaption><p>Wireshark Results</p></figcaption></figure>

[^1]:
