PSKeePass / PoShKeePass

PowerShell module for KeePass
MIT License
255 stars 56 forks source link

crash after Get-KeePassEntry #208

Open tikondrus opened 1 year ago

tikondrus commented 1 year ago

I have been using the powershell script for over a year and today I noticed that something is not working. after debugging found that the script crashes after Get-KeePassEntry. So I don't understand what the root cause of this behaviour. During this year I didn't change windows, powershell, ps module versions or something else.

my code is

` New-KeePassDatabaseConfiguration -DatabaseProfileName 'KeePass' -DatabasePath $dbpath -UseMasterKey -Default

$keepasskey = Get-Content $global:masterpass -raw

$Securekeepasskey = ConvertTo-SecureString $keepasskey –asplaintext –force

Get-KeePassEntry -AsPlainText -DatabaseProfileName 'KeePass' -MasterKey $Securekeepasskey `

after that I get an error

tikondrus commented 1 year ago
keepass error

after several times ignoring cmdlet get entries. but I cant ignore this error with -ErrorAction SilentlyContinue and can't catch it with try-catch construction

tikondrus commented 1 year ago

I see than error is like in this issue https://github.com/PSKeePass/PoShKeePass/issues/148 but I only get entry, not update

ePaint commented 11 months ago

I'm getting exactly the same issue on Get-KeePassEntry

jberezanski-mdg commented 6 months ago

It looks like the old KeePassLib included in the module (2.39.1) is unable to handle some recent changes to the kdbx file format. Here is a quick and dirty workaround:

  1. Download the newest KeePass portable release (2.56 as of today) and extract KeePass.exe (yes, the EXE, not any of the dlls!) from the zip. If you have KeePass installed on your machine, just take C:\Program Files\KeePass Password Safe 2\KeePass.exe.
  2. Save KeePass.exe as KeePassLib_2.39.1.dll in the bin subdirectory of the PoShKeePass module (usually $Env:UserProfile\Documents\WindowsPowerShell\Modules\PoShKeePass\2.1.3.0\bin\KeePassLib_2.39.1.dll when the module is installed at user profile scope and the Documents folder is not redirected).

A proper fix would be to obtain/create a build of KeePassLib.dll for the current KeePass version and release a new PoShKeePass version with this dll included.

tikondrus commented 6 months ago

Thanks a lot, but I've tried to swap dll from Keepass portable and it didn't help. After weeks of misunderstanding and ignorance I've migrated my project from Keepass to Hashicorp vault.