TPM-Keepass-Import is a PHP script to import projects and passwords from KeePass Password Safe XML 2.x files into Team Password Manager. It does so using the Team Password Manager API. It is provided for free and in source code form.
MD5 Hash: 5070578e6cd2de5a46210dab5e725f70 (how to check)
Released December 27, 2022
Requirements
TPM-Keepass-Import needs the following components to run:
- PHP 5.6.x+ and a web server (optional if you execute the importer from the command line). PHP needs the following extensions: XMLReader and curl. You can use the same server of your installation of Team Password Manager.
- A Team Password Manager installation with API v. 5, with the API enabled. Go to Settings | API to check this.
- A user in this installation. This user must have one of the following roles: Project Manager, IT or Admin.
- A Keepass XML 2.x file. To get this file go to File | Export in Keepass and select the "KeePass XML (2.x)" format.
How To Use
For these instructions we'll use the following data of a fictional installation of Team Password Manager: URL: https://localhost/tpm, Username: john, Password: demopassword.
1. Decompress the zip file (tpm_keepass_import_x.y.zip). You'll get 2 files: TPM_Keepass_Import.php
and tpmki.php
2. Create a folder in your server (below www-root) and upload these two files to it. Let's call this folder "tpm_keepass", and we'll be able to access it with a browser in the following URL: https://localhost/tpm_keepass/.
3. Make sure that Apache can write files to the "tpm_keepass" folder (for the import logs).
4. Upload your Keepass exported XML file into the "tpm_keepass" folder. Let's call this file "my_keepass.xml".
5. Edit the tpmki.php file and fill in the variables under the PARAMETERS section. In our example:
// **************** PARAMETERS **************** // File to import (Keepass XML 2.x format) $kfile = 'my_keepass.xml'; // URL (including index.php) of the installation of Team Password Manager // Example: http://localhost/index.php $tpm_url = 'https://localhost/tpm/index.php'; // Username and password (must be Project Manager, IT or Admin) $tpm_username = 'john'; $tpm_password = 'demopassword';
6. Choose the parent project where all the data will be imported. To get the ID for this project, go to the project you want in Team Password Manager and notice the number in the last section of the URL of the project. For example: http://localhost/tpm/index.php/prj/view/2 => the ID is 2. Enter this ID in the $parent_project_id
variable, or use 0 for root:
// Parent project ID (0=root) // You can see the ID of the project in its URL: $tpm_url/prj/view/ID $parent_project_id = 0;
7. There are also two variables that you can use: $test
and $pretty_print_log
. Setting $test = TRUE
will only read the XML file and output results to the log, without importing anything. It's recommended that you use this value the first time you execute the importer. $pretty_print_log = TRUE
will show the projects hierarchy in the log.
// Test import and pretty print log $test = FALSE; $pretty_print_log = TRUE;
8. Everything is now ready to execute the importer. To do so, open the following URL in your browser: https://localhost/tpm_keepass/tpmki.php
(remember this is an example, use your URL in your case). If everything is ok (no output is shown), after a while your projects and passwords will be imported and a log file will be created in the "tpm_keepass" folder. In Team Password Manager, refresh the tree or click on "Home" to see the changes. If there's an error it will be shown on the screen and the import process will be halted.
Note that you can also execute the importer directly from the command line (great for automation). To do so, go to the "tpm_keepass" folder in your shell and enter this: php tpmki.php
.
Change log
1.9 - 20221227
- Error message bug.
- API v.5 by default.
- Connection checker.
1.6 - 20170602
- Minor changes.
- Tested with keepass 2.35.
1.5 Beta - 20160825
- Accept any server certificate in the API requests.
1.4 Beta - 20160722
- Little bug.
1.3 Beta - 20160721
- If there's not Title (passwords) or Name (projects), we add it: "No name " + #RENx# (x=counter).
1.2 Beta - 20160720
- Rename projects with the same name with the same parent with this suffix: #RENx# (x=counter).
- Rename passwords with the same name in the same project with this suffix: #RENx# (x=counter).
1.0 Beta - 20160718
First version released to public.