Downloading files from Target
Different ways to download files from Target Machine.
WGET
Python HTTP Server
Start a python server on the host machine
cd /tmp
python3 -m http.server 8000
Download file from target:
You can also use cURL:
SCP
This assumes we have ssh access to the target machine
File will be downloaded to the /tmp directory
Base64
In some cases, we may not be able to transfer the file. For example, the remote host may have firewall protections that prevent us from downloading a file from our machine. In this type of situation, we can use a simple trick to base64 encode the file into base64
format, and then we can paste the base64
string on the remote server and decode it. For example, if we wanted to transfer a binary file called shell
, we can base64
encode it as follows:
Now, we can copy this base64
string, go to the remote host, and use base64 -d
to decode it, and pipe the output into a file:
Validating File Transfer
Sometimes we need to validate the file transfer. We can utilize the file
command and md5sum
command to do this.
File
Confirm file type
MD5SUM
On host machine:
On Target Machine
Compare output from both and make sure they match. If not, then something went wrong in the transfer or encode/decode process.
Last updated