Base64 Encode & Decode

Windows ➜ Linux

## check the file hash
Get-FileHash .\file.txt -Algorithm MD5

## convert it
[Convert]::ToBase64String([IO.File]::ReadAllBytes("C:\Users\username\Desktop\file.txt")) | Out-File C:\Users\username\Desktop\file.b64

Copy file.b64 content to your attacker machine

## decode it
base64 -d file.b64 > file.txt

## check the file hash
md5sum file.txt

Linux ➜ Windows

## encode the file
base64 file.txt > file.b64

Copy file.b64 content to Windows

## decode it
[IO.File]::WriteAllBytes("C:\Users\username\Desktop\file.txt",
[Convert]::FromBase64String((Get-Content "C:\Users\username\Desktop\file.b64")))

Last updated