# encoding: ascii
# api: powershell
# title: Decrypt Psi Password
# description: Script courtesy of Jaykul, I’m just reposting. This script will decode the passwords for all accounts in the Psi profile labeled “default”.
# version: 0.1
# type: function
# author: jvarga
# license: CC0
# function: decrypt-psi
# x-poshcode-id: 3597
# x-archived: 2012-09-05T18:39:26
# x-published: 2012-08-28T04:49:00
#
# halr9000: gave post a proper title
#
function decrypt-psi ($jid, $pw) {
$OFS = ""; $u = 0;
for($p=0;$p -lt $pw.Length;$p+=4) {
[char]([int]"0x$($pw[$p..$($p+3)])" -bxor [int]$jid[$u++])
}
}
$accounts = ([xml](cat ~\psidata\profiles\default\accounts.xml))["accounts"]["accounts"]
foreach($account in ($accounts | gm a[0-9]*)) {
$a = $accounts.$($account.Name)
"$($a.jid.'#text'):$( decrypt-psi $a.jid.'#text' $a.password.'#text' )"
}