• Diniz Martins

PowerShell | Encoding & Decoding (Base64)

PowerShell provides an easy method for Base64 encoding and decoding.


Encoding:

$pass="STENGE.info"
$encodePass=[System.Text.Encoding]::Unicode.GetBytes($pass)
$encodeStr=[Convert]::ToBase64String($encodePass)
$encodeStr

The result is this base64 encoded text:

UwBUAEUATgBHAEUALgBpAG4AZgBvAA==

Decoding:

$encodeStr="UwBUAEUATgBHAEUALgBpAG4AZgBvAA=="
$bytesData=[System.Convert]::FromBase64String($encodeStr)
$decodeValue=[System.Text.Encoding]::Unicode.GetString($bytesData)
$decodeValue

The result:

STENGE.info


And if you want to convert a file, it should look something like :

$fileName = "C:\usr\key.txt"
$fileContent = get-content $fileName
$fileContentBytes = [System.Text.Encoding]::Unicode.GetBytes($fileContent)
$fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes)
$fileContentEncoded | set-content ($fileName + ".b64")


36 views0 comments

Recent Posts

See All

Be careful what you send to the Recycle Bin!

As you know, it is common to use the Windows Recycle Bin to dispose of those files that we no longer use. However, we must pay special attention to what we send to trash, as the security of your data

Ping & Send WhatsApp Message

In this post we will show you how to create a ping monitoring tool and send the result message to your phone using WhatsApp. First you need to enable a developer mode on you Excel to make it works. No

Browser Extensions

You know what software your target is running but how do you determine what vulnerabilities it has? The whole point of l earning a target technology stack is so you can use this information to find as