Whether you are solving a machine/lab, or engaging in a penetration testing assessment there will be times where you are required to transfer a file, it can be from your host to the target's host (windows/linux) or vice versa. Here I share a few tricks on how you can transfer files from Windows Machine to your Kali host.
With impacket we can use the utility impacket-smbserver
to start an SMB server and use it to transfer files from windows.
Replace
YOUR_KALI_IP
with your Kali Linux host's IP.
Evil-WinRM has built-in commands known as upload
and download
which can be used to upload and download files respectively.
Some of the impacket utilities such as impacket-psexec
, impacket-wmiexec
, impacket-smbexec
have built-in commands such as lput
and lget
that can be used to upload and download a file.
A file that is uploaded with this command, will be uploaded to the *C:\Windows* directory.
If the windows machine has a RDP port open, we can mount shared folders and copy files.
SCP can be useful especially when transferring large files.
Base64 encoding/decoding can be used as a way to transfer files from/to windows.
Contents of webshell.php
Encoding the content of webshell.php, you can use either one of these commands to encode the webshell to base64, then copy the output.
Run any of the commands below to start a HTTP webserver
Although there are more methods/techniques used to transfer files, the few mentioned above are most used methods in common pentesting scenarios allowing you to easily transfer files from windows to your kali linux host.