keepass
KeePass .kdbx database file parser for Rust
Example
extern crate keepass;
use keepass::{Database, Node, OpenDBError};
use std::fs::File;
fn main() {
let db = File::open(std::path::Path::new("test/sample.kdbx"))
.map_err(|e| OpenDBError::Io(e.to_string()))
.and_then(|mut db_file| Database::open(&mut db_file, "demopass"))
.unwrap();
for node in &db.root {
match node {
Node::Group(g) => {
println!("Saw group '{0}'", g.name);
},
Node::Entry(e) => {
let title = e.get_title().unwrap();
let user = e.get_username().unwrap();
let pass = e.get_password().unwrap();
println!("Entry '{0}': '{1}' : '{2}'", title, user, pass);
}
}
}
}
Installation
Add the following to the dependencies
section of your Cargo.toml
:
[dependencies]
keepass = "*"
License
MIT