PHP Classes

PHP KeePassX Writer: Create database of passwords for KeePass

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 61 All time: 10,489 This week: 56Up
Version License PHP version Categories
kpx-writer-php 1.0.0GNU Lesser Genera...5PHP 5, Files and Folders, Unix, Security
Description 

Author

This package can create database of passwords for KeePass.

Each site may be included in a group. The class can also be used to define a hierarchy of groups and have a icon image be associated with each group.

It can take the definitions of user account to access sites and the respective passwords and creates a database file for use with the KeePass browser extension.

The resulting password database file is generated using the KeePass utility program that can be run from the command line interface shell.

Innovation Award
PHP Programming Innovation award nominee
January 2021
Number 12
KeePass is a password management application that allows its users to securely store passwords that can be used to access certain sites.

With this application, users do not need to remember and type those passwords every time they need to access a site that is protected by requiring its users to enter a password.

This package allows PHP scripts to run from the command line to create a database file with given site passwords.

Manuel Lemos
Picture of Colin McKinnon
  Performance   Level  
Innovation award
Innovation award
Nominee: 4x

 

Example

<?php

require_once('include/KeePassWriter.inc.php');

$kpx=new KeePassWriter(
   
getenv("HOME") . "/sample.kdbx", // database to create
   
"letmein", // passphrase for new database
   
20, // timeout for writing to keepassxc-cli (optional)
   
'/usr/bin/keepassxc-cli'); // path to binary (optional)

// groups are created automatically, but if we want to assign notes
// or specific icons then we use 'addgroup'
// addgroup($path, $notes, $icon=false)
$kpx->addgroup("/home", "Home folder", KPX_ICON_HOME);
$kpx->addgroup("/infrastructure/network", "Switches etc", KPX_ICON_NETWORK_BOXES);
$kpx->addgroup("/infrastructure/linux", "Linux hosts", KPX_ICON_TUX);
$kpx->addgroup("/infrastructure/external", "3rd Party services", KPX_ICON_CLOUD);
$kpx->addgroup("/infrastructure/Microsoft", "MS Windows hosts", KPX_ICON_MSWINDOWS);
$kpx->addgroup("/applications", "In-house apps", KPX_ICON_YELLOW_DOC);
$kpx->addgroup("/database", "Admin accounts", KPX_ICON_DB_BURGER_KEY);
$kpx->addgroup("/encryption", "Encryption keys", KPX_ICON_KEYRING);

// add some entries
// additem($path, $title, $username, $secret, $url, $notes)
$kpx->additem("/infrastructure/linux", "root@example.com"
   
, "root", "sw0rd1sh", "ssh://root@example.com"
   
, "Assunming the host is configured to allow root logins via ssh");
$kpx->additem("/infrastructure/network", "admin@10.1.1.254(Cisco)"
   
, "admin", "pass123", "ssh://admin@10.1.1.254"
   
, "Admin user on Cisco");

// we can display the generated XML....
// $kpx->writedata(STDOUT);

$kpx->createdb();



  Files folder image Files (4)  
File Role Description
Files folder imageinclude (2 files)
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:61
This week:0
All time:10,489
This week:56Up