Giter Club home page Giter Club logo

keepass-rs's Introduction

keepass

Crates.io Documentation Build Status codecov

KeePass .kdbx database file parser for Rust

Example

extern crate keepass;

use keepass::{Database, NodeRef, Result, Error};
use std::fs::File;

fn main() -> Result<()> {
    // Open KeePass database
    let path = std::path::Path::new("tests/resources/test_db_with_password.kdbx");
    let db = Database::open(
        &mut File::open(path)?,         // the database
        Some("demopass"),               // password
        None                            // keyfile
    )?;

    // Iterate over all Groups and Nodes
    for node in &db.root {
        match node {
            NodeRef::Group(g) => {
                println!("Saw group '{0}'", g.name);
            },
            NodeRef::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);
            }
        }
    }

    Ok(())
}

Installation

Add the following to the dependencies section of your Cargo.toml:

[dependencies]
keepass = "*"

Performance note: Please set the RUSTFLAGS environment variable when compiling to enable CPU-specific optimizations (this greatly affects the speed of the AES key derivation):

export RUSTFLAGS='-C target-cpu=native'

For best results, also compile in Release mode.

Alternatively, you can add a .cargo/config.toml like in this project to ensure that rustflags are always set.

Developer Tools

kp-dump-xml

This library contains an optionally-compiled command line application to dump out the internal XML representation from a KDBX database. This can be useful for implementing additional features for the XML parser.

Since the tool depends on additional crates, it is not compiled until you specify the utilities feature, e.g.

cargo run --release --features "utilities" --bin kp-dump-xml -- path/to/database.kdbx

License

MIT

keepass-rs's People

Contributors

sseemayer avatar strangelittlemonkey avatar mmrath avatar linkmauve avatar leaty avatar laomaiweng avatar orion78fr avatar narigo avatar sts10 avatar scottmmjackson avatar jgrussell avatar llogiq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.