Tuesday 27 October 2020

 

 Recover OpenVPN Saved Password

 

The Powershell script in this link gets the password for me: OpenVPN Password Recovery

 

Step 1: Open Powershell in windows.

Step 2: Execute Add-Type -AssemblyName System.Security in Powershell.

Step 3: Execute following code

$keys = Get-ChildItem "HKCU:\Software\OpenVPN-GUI\configs"
$items = $keys | ForEach-Object {Get-ItemProperty $_.PsPath}

foreach ($item in $items)
{
  $encryptedbytes=$item.'auth-data'
  $entropy=$item.'entropy'
  $entropy=$entropy[0..(($entropy.Length)-2)]

  $decryptedbytes = [System.Security.Cryptography.ProtectedData]::Unprotect(
    $encryptedBytes, 
    $entropy, 
    [System.Security.Cryptography.DataProtectionScope]::CurrentUser)
 
  Write-Host ([System.Text.Encoding]::Unicode.GetString($decryptedbytes))
} 
Your Password will be printed as you press enter. 


Note:

       If you are using windows 10, OpenVPN v11.9, than use $encryptedbytes=$item.'key-data'

 


1 comment: