So we have found the base64 string “SGVsbG9Xb3JsZCE=” on a locked down workstation and we want to decode. Quite often we don’t have access to tools so here’s a list of ways to decode the string using various languages.
Python
1 2 | >>> import base64 >>> base64.b64decode("SGVsbG9Xb3JsZCE=") |
PowerShell
1 2 | PS > [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("SGVsbG9Xb3JsZCE=")) blahblah |
Perl
1 2 |
BASH
1 | echo SGVsbG9Xb3JsZCE= | base64 --decode |
php
1 |
C#
1 2 | byte[] data = Convert.FromBase64String("SGVsbG9Xb3JsZCE="); string decodedString = Encoding.UTF8.GetString(data); |
VisualBasic
1 2 3 4 5 6 | Dim base64Encoded As String = "SGVsbG9Xb3JsZCE=" Dim base64Decoded as String Dim data() As Byte data = System.Convert.FromBase64String(base64Encoded) base64Decoded = System.Text.ASCIIEncoding.ASCII.GetString(data) msgbox(base64Decoded) |
Java
1 2 | import java.util.Base64; byte[] decoded = Base64.getDecoder().decode("SGVsbG9Xb3JsZCE="); |
JavaScript
1 | atob("SGVsbG9Xb3JsZCE=") |
Ruby
1 2 | require "base64" decoded_string = Base64.decode64('SGVsbG9Xb3JsZCE=') |
MySQL
1 |
Leave a Reply
You must be logged in to post a comment.