Skip to content

Instantly share code, notes, and snippets.

@AhsenBaig
Forked from idiom/psdecode.ps1
Created February 24, 2022 00:21
Show Gist options
  • Select an option

  • Save AhsenBaig/8e4c428185dec2c819fa2d89ecfd4f12 to your computer and use it in GitHub Desktop.

Select an option

Save AhsenBaig/8e4c428185dec2c819fa2d89ecfd4f12 to your computer and use it in GitHub Desktop.
Script to decode a Base64 Encoded and Compressed PowerShell script
#
# 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 -----"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment