Szupi ps dekripter

param (
    [string]$InputFile,
    [string]$OutputFile,
    [string]$Password
)
$Base64Data = Get-Content $InputFile -Raw
$EncryptedBytes = [System.Convert]::FromBase64String($Base64Data)
$Salt = $EncryptedBytes[0..15]
$IV = $EncryptedBytes[16..31]
$CipherText = $EncryptedBytes[32..($EncryptedBytes.Length-1)]
$Rfc2898 = New-Object System.Security.Cryptography.Rfc2898DeriveBytes($Password, $Salt, 10000)
$Key = $Rfc2898.GetBytes(32)
$Aes = [System.Security.Cryptography.Aes]::Create()
$Aes.KeySize = 256
$Aes.BlockSize = 128
$Aes.Mode = [System.Security.Cryptography.CipherMode]::CBC
$Aes.Padding = [System.Security.Cryptography.PaddingMode]::PKCS7
$Aes.Key = $Key
$Aes.IV = $IV

$Decryptor = $Aes.CreateDecryptor()
$DecryptedBytes = $Decryptor.TransformFinalBlock($CipherText, 0, $CipherText.Length)
$Aes.Dispose()
[System.IO.File]::WriteAllBytes($OutputFile, $DecryptedBytes)

Write-Host "Visszafejtés befejezve: $OutputFile"

 

 

 

$Base64Data = "BASE64_SZÖVEG"
$Password = "JELSZÓ"

try {
    $EncryptedBytes = [Convert]::FromBase64String($Base64Data)

    $Key = (New-Object System.Security.Cryptography.SHA256Managed).ComputeHash([Text.Encoding]::UTF8.GetBytes($Password))
    $AES = New-Object System.Security.Cryptography.AesManaged
    $AES.Mode = [System.Security.Cryptography.CipherMode]::CBC
    $AES.Padding = [System.Security.Cryptography.PaddingMode]::PKCS7
    $AES.Key = $Key

    $IV = $EncryptedBytes[0..15]
    $CipherText = $EncryptedBytes[16..($EncryptedBytes.Length - 1)]
    $AES.IV = $IV

    $Decryptor = $AES.CreateDecryptor()
    $DecryptedBytes = $Decryptor.TransformFinalBlock($CipherText, 0, $CipherText.Length)

    $DecryptedText = [Text.Encoding]::UTF8.GetString($DecryptedBytes)
    Write-Output "Dekódolt szöveg:"
    Write-Output $DecryptedText

catch {
    Write-Error "Hiba történt a dekódolás során: $_"
}