Created
April 24, 2017 18:15
-
-
Save idiom/a1940bc1c7496e3e431c023ce0728608 to your computer and use it in GitHub Desktop.
Script to decode a Base64 Encoded and Compressed PowerShell script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Decode a base64 and compressed Powershell script. | |
# | |
# | |
# | |
# | |
$input = Read-Host -Prompt 'Base64 Text' | |
$decoded = $(New-Object IO.StreamReader ($(New-Object IO.Compression.DeflateStream($(New-Object IO.MemoryStream(,$([Convert]::FromBase64String($input)))), [IO.Compression.CompressionMode]::Decompress)), [Text.Encoding]::ASCII)).ReadToEnd(); | |
Write-Host "----- Decoded -----" | |
Write-Host $decoded | |
Write-Host "----- Decoded End -----" |
Exception calling "ReadToEnd" with "0" argument(s): "Unknown block type. Stream might be corrupted."
Got the same error as sp00ks-git mentioned above
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice and easy script. I am going to taking inspiration form this to implement into a project. Thank you!