Base64
We can use the base64 command to encode and transfer files to a target machine during an engagement.
To encode a file, we can use the following command:
base64 FILE_NAME -w 0
Command breakdown:
FILE_NAME- Specifies the file to encode.-w- Specifies how many lines to output.
An example will be:
base64 myfile -w 0
Once we get our string, we can use the following command to decode and save the string as a file:
echo 'base64_string_here' | base64 -d > FILE_NAME
Command breakdown:
'base64_string_here'- The base64 string from the encode command.-d- Specifies the decode option.> FILE_NAME- Specifies the file to save the output to.
An example will be:
echo 'U2VjcmV0IGJhc2U2NAo=' | base64 -d > secret_message.txt