Git Product home page Git Product logo

csv2keepassxml's Introduction

From CSV into KeePass 2 XML

This is a simple Ruby script that will convert any CSV file into an XML document compatible with the KeePass 2 format.

Requirements

The script depends on the htmlentities library. To install it:

gem install htmlentities

Depending on your Ruby configuration, you may need to run this command with sudo.

Synopsis

$ ./csv2keepassxml --help
Usage: csv2keepassxml [options] <path>

NOTE: Column indexes are 1-based.

    -g, --group NUM                  Column index for categories
    -n, --notes NUM                  Column index for notes
    -p, --password NUM               Column index for passwords
    -t, --title NUM                  Column index for titles
    -u, --username NUM               Column index for usernames
    -U, --url NUM                    Column index for URLs
    -T, --tags NUM,NUM,...           Column index(es) for tags
        --tags-separator SEP         Tag separator (default: ';')
    -F, --custom-fields NUM,NUM,...  Column index(es) for custom fields
    -d, --dbname NAME                Name of the database
    -H, --[no-]header                Parse a CSV with/without header
    -M, --macoskeychain              Parse the output of CSVKeychain
    -h, --help                       Prints this help
    -v, --[no-]verbose               Be verbose

If your CSV does not contain some data (e.g., it does not have a column with notes), simply leave out the corresponding option.

Option -M is specifically for importing CSV files generated by CSVKeychain. If you use -M you do not need to specify any column mappings (except possibly for tags and custom fields).

If you use macOS, the generated XML file may be imported by MacPass (v0.6.2-alpha or later) or KeeWeb.

KeePassXC can import CSV files, although, as far as I know, as of v2.2.0 it cannot import tags or custom fields.

KyPass Companion for macOS has a CSV importer, too.

csv2keepassxml's People

Contributors

lifepillar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

csv2keepassxml's Issues

How can I add tags from multiple columns?

In my csv file, I'd like columns 4 and 5 to become tags on each entry.

I see the s += "<Tags/>" line in the xml_entry function. I'm guessing I would modify that line somehow to add the tags. I think I'd add an option to the command line with a list of column numbers to use, and then something like:

  s += "<Tags>"
  # code to add each tag here. would it just be a comma separated list, or is the sub xml element? 
  s += "</Tags>"

Any suggestions on how to make that happen?

Passwords not displayed as dots on import

After importing an xml file generated by csv2keepassxml, the password field displays the text of the password instead of the normal dots.

Steps to reproduce:

  • Generate xml file.
  • Import xml file into KeeWeb.
  • View any entry, the password is visible without you clicking in the field.

This is also true if you save the file as a kdbx file and then reopen it. I even made sure to remove it from the initial list of available files you get when you don't have any open.

I did some searching and found keeweb/keeweb#85 Looking at the raw xml, the password value looks like this:

<String>
  <Key>Password</Key>
  <Value ProtectedInMemory="True">password</Value>
</String>

Which sounds like what that issue was suggesting needed to be done.

So, yeah, I'm not sure if this is something caused by the convert and import process, or a bug in KeeWeb. If you think it's keeweb, let me know and I'll open an issue there.

App info:

KeeWeb v1.3.3 (52701af, 2016-09-20)
Environment: electron v1.3.3
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) KeeWeb/1.3.3 Chrome/52.0.2743.82 Electron/1.3.3 Safari/537.36

I'm on Ubuntu 16.04.

How would I add fields based on columns?

In my csv I have an ip address field that I would like to use as a custom field in my KeeWeb file.

Would I add a new opts.on block? Something like:

opts.on("-F", "--field NUM", Integer, "Column number of custom field") do |o|
    options[:field] = o
  end

How would I tell it what to name the field? Or would I need to just add a custom opts.on block for each custom field I want to add?

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.