ioguimaraes/ready-keepass-php

用于读取 KeePass 2.x 数据库的库

v1.0 2023-08-15 18:11 UTC

This package is auto-updated.

Last update: 2024-09-15 21:46:30 UTC


README

变更

  • 重构项目以使用 PSR-4 自动加载
  • Meta 中实现二进制(KeePass 中的附件)的处理,以及 Entry 标签中的引用。

用法

require_once '../vendor/autoload.php';

use KeePassPHP\KeePassPHP;
use KeePassPHP\Key\CompositeKey;
use KeePassPHP\Lib\Database;

$file = '/path/to/your/file.kdbx';
$secret = 'YouKdbxPassword';

//Store any error messages
$err = '';
//Create a composite key
$ckey = new CompositeKey();
//Attach the password key
$ckey->addKey( KeePassPHP::keyFromPassword( $secret ) );
//Open the databsae file
/** @var Database $db */
$db = KeePassPHP::openDatabaseFile($file, $ckey, $err);
//Iterate the list of binaries
foreach($db->getBinaries() as $binary) {
    echo $binary->getContent() ."\r\n---\r\n";
}