MrC's Convert to 1Password Utility (mrc-converter-suite)

Options
1121315171852

Comments

  • MrC
    MrC
    Volunteer Moderator
    edited February 2016
    Options

    @mclarenm ,

    You could use CSV, but it has limitations. See: How to create a 1Password compatible CSV file.

    There is no spec for the 1PIF format. You could use my converters Utils/PIF.pm module as guidance, but it is a much bigger job than you might be considering.

    I'm happy to write the converter, its just that my systems are still offline (due to our move back to our remodeled home) and I have a couple of other things ahead of it. You're welcome to try your had at creating a converter module - see various samples in the Converters directory in the converters package.

  • james2323
    james2323
    Community Member
    Options

    C:\Users\My username\Desktop\convert_to_1p4>perl convert_to_1p4.pl onepif2html -v ..\eksport.csv
    Uncaught exception from user code:
    malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "(end of string)") at Utils/PIF.pm line 919.
    JSON::PP::decode_error("malformed JSON string, neither array, object, number, string "...) called at C:/myperl/perl/lib/JSON/PP.pm line 693
    JSON::PP::PP_decode_json(JSON::PP=HASH(0x3dac218), "", 0) called at C:/myperl/perl/lib/JSON/PP.pm line 148
    JSON::PP::decode(JSON::PP=HASH(0x3dac218), "") called at C:/myperl/perl/lib/JSON/PP.pm line 110
    JSON::PP::decode_json("") called at Utils/PIF.pm line 919
    Utils::PIF::get_items_from_1pif("..\eksport.csv") called at Converters/Onepif2html.pm line 76
    Converters::Onepif2html::do_import("..\eksport.csv", undef) called at convert_to_1p4.pl line 123

    What the hell is wrong.

  • MrC
    MrC
    Volunteer Moderator
    edited February 2016
    Options

    @james2323,

    Can you describe what eksport.csv is? And what are you trying to accomplish?

    You are using the converter (onepif2html) that takes a 1Password 1PIF export and converts it into HTML for printing, so your CSV file doesn't make sense here.

  • james2323
    james2323
    Community Member
    Options

    Oh, so I should choose the file I'm importing. It works now. Thanks for your clarity.

  • AGAlumB
    AGAlumB
    1Password Alumni
    edited February 2016
    Options

    The best part is you only have to do it once! I'm glad that MrC was able to help guide you to success — but you deserve the credit for persevering. :chuffed:

  • heme
    heme
    Community Member
    Options

    still waiting ..

  • MrC
    MrC
    Volunteer Moderator
    edited February 2016
    Options

    @heme,

    The debug info presented in your previous screenshot indicates you are trying to access the Keychain file itself rather than the exported keychain contents. Your debug info should look like:

    print_fileinfo      : Export file info
    print_fileinfo      :   size: 23764
    print_fileinfo      :   kind: ASCII English text, with very long lines
    print_fileinfo      :   mime: text/plain; charset=us-ascii
    

    But yours indicates it is an OS X Keychain File:

    Make sure you are exporting the file's contents as per the README.

  • evertype
    evertype
    Community Member
    Options

    I have this problem, or a related one. I'm not using iCloud. I have this command in Terminal:

    security dump-keychain -d login.keychain > ~/Desktop/pm_export.txt

    And I have this in Script Editor:

    tell application "System Events"
    repeat while exists (processes where name is "SecurityAgent")
    tell process "SecurityAgent"
    click button "Allow" of window 1
    end tell
    delay 0.75
    end repeat
    end tell

    And I get this error:

    error "System Events got an error: Can’t get window 1 of process \"SecurityAgent\". Invalid index." number -1719 from window 1 of process "SecurityAgent"

    What do I do?

  • MrC
    MrC
    Volunteer Moderator
    Options

    @evertype ,

    Which OS version are you running?

  • evertype
    evertype
    Community Member
    Options

    I have got both iOS and MacOS versions of your software (today) and I'm running the most current versions of each. 10.11.3 is where I'm trying to import my Safari (and afterwards Chrome) data from my keychain. (If that's right. Maybe it's all there?)

  • MrC
    MrC
    Volunteer Moderator
    edited March 2016
    Options

    Hi @evertype,

    I just wanted to verify on which version of OS X you were running the AppleScript.

    If you got that error at the very end, ignore it. It can happen when the last OK was pressed, and the script races to try again, but there are no more items to export, and when the script tries to hit OK again, there is no such window. This is, not coincidentially, called a race condition, and its a bit of a limitation in the way that the simplistic Click OK script works.

    You can check if your exported items contains some contents, and then try a conversion on that file. The converter, with the -v option, will indicate how many items it converted.

    Please note, I don't work for AgileBits, and for any shortcomings of the conversion process please direct any blame or criticism to me.

  • evertype
    evertype
    Community Member
    Options

    No criticism to you. Thanks. Well, there is stuff in the file. I don't know if I got the error at "the end" because if it got stuck somewhere in the middle I'd not know since it displays that error as the last thing it did... But OK, I'll try converting on that.

  • MrC
    MrC
    Volunteer Moderator
    Options

    @evertype,

    Yes, that's exactly the error situation you'd get. Go ahead and convert. I was going to document this, but I had started a rework of the AppleScript Conversion Helper for KeyChain conversions to manage this for you, and that would supersede this matter altogether.

  • evertype
    evertype
    Community Member
    Options

    Something to be ready in due course, or soon?

  • MrC
    MrC
    Volunteer Moderator
    Options

    @evertype,

    It will be a little while. I have a lot on my plate right now.

  • evertype
    evertype
    Community Member
    Options

    I imported the file. Well, there are 45 things now in 1Password. But I think that's a very low number compared to the pages which I think Safari remembers....

  • MrC
    MrC
    Volunteer Moderator
    edited March 2016
    Options

    @evertype,

    You can use Keychain Access to examine how many items you have.

    In case the Click OK script is causing a problem, you could just manually click OK to each export request. It will only take a few minutes. Then try converting again. You don't have to import, just convert and look at the output to see how many items were examined and exported.

    In case the converter is failing on something, which version of the converter are you using. I'd recommend 1.09, since it resolved at least one Keychain issue (but the issue might only be present with an iCloud-based keychain - I'm not sure). And also, there is better debugging diagnostics in case we get to that point. Version 1.09 is in Testing Bits mentioned in the converter suite.

  • evertype
    evertype
    Community Member
    Options

    I did use 1.09. I'll try the manual clicking tomorrow.

  • evertype
    evertype
    Community Member
    Options

    In Keychain Access, if it's login / Category > All Items, I have 375 items there. login / Category > Passwords has 119 items,

  • MrC
    MrC
    Volunteer Moderator
    edited March 2016
    Options

    @evertype,

    There are quite a few entries that are inappropriate for importing into 1Password, and those are skipped. There are also several duplicates. You can run the converter with debug enabled to see those items. Here's how my keychain works out:

    First, lets see how many items are in the keychain:

    $ grep '^keychain' ~/Desktop/pm_export.txt  | wc -l
         260
    

    Ok, there are 260 items. Now let's see what the converter does with debug enabled:

    $ perl convert_to_1p4.pl keychain ~/Desktop/pm_export.txt -v -d | egrep -i 'exported|skipped'
    Skipped 207 non-login items
    Skipped 5 duplicate items
    Exported 47 login items
    Exported 1 note item
    Exported 48 total items
    

    So, I have 260 items - 5 dups - 207 non-login items, for a total of 48, which matches the converters export total of 48.

  • evertype
    evertype
    Community Member
    Options

    I'm afraid I was unable to make use if those. I got pushed back to ~bash $: command not found

  • MrC
    MrC
    Volunteer Moderator
    edited March 2016
    Options

    Remove the $ characters. That's the shell's prompt. It is commonplace to show it in output so that you can see what is the command and what is the output.

  • evertype
    evertype
    Community Member
    Options

    Well, well. 43 items plus two I'd put into 1Password myself .Seems very few. Thanks for your help.

  • ThePhantom
    ThePhantom
    Community Member
    Options

    I need help, i tried the converter but i get an error:
    Smartmatch is experimental at keepass2_to_1p4.pl line 74.
    Imported 609 cards
    Exporting 575 login items
    Exporting 34 note items

    Why did it separate my wallet into 2 parts? I had both the pl file and wallet file in a different drive.

  • MrC
    MrC
    Volunteer Moderator
    edited March 2016
    Options

    Hi @ThePhantom,

    Edit: Never mind - you are using a VERY old version of the original Keepass2 converter. Use instead the keepass2 converter in the converter suite.


    You must be using a very old version of the converters. At the top of both the convert_to_1p4.pl and Converters/Keepass2.pm files, what are the version numbers? They will look like this:

    my $version = "1.08";

    and

    package Converters::Keepass2 1.04;

  • ThePhantom
    ThePhantom
    Community Member
    edited March 2016
    Options

    How do i pick a different drive and path? I was using converter 1.04. Ok i am now using 1.09. what am i doing wrong. i am getting this now.

    O:>perl convert_to_1p4.pl keepass2.pm -v ..\1Pconvert.xml
    Invalid converter specified
    Usage: convert_to_1p4.pl

    Select a converter:
    clipperz csv dataguardian datavault essentialpim ewallet fsecurekey handysafe ironkeyim
    keepass2 keepassx keeper keychain lastpass licensekeeper msecure nortonis onepif2html
    passpack passwordagent passworddepot passwordsplus passwordwallet roboform safeincloud
    safewallet spbwallet splashid txt2notes vcard

    Select one of the converters above and add it to the command line to see more
    complete options. Example:

        perl convert_to_1p4.pl ewallet --help
    

    I tried copying the keepass2.pm to a few locations perl64,strawberry dirs and it still wont work. What is the syntax i should use. i am doing all from O: i put both the convert_to_1p4.pl, the 1pconvert.xml(file I am converting) into that drive.

  • MrC
    MrC
    Volunteer Moderator
    edited March 2016
    Options

    @ThePhantom ,

    Use the version 1.08 in Stable Bits or preferably the 1.09 version in Testing Bits of the converter suite. It contains all of the converters. Prior to creating the suite, I had created a few individual converters. That is what you were using. Those are obsolete - don't use them.

    The convert_to_1p4.pl main program in the converter suite allows you to specify a path to an export file using the command line argument. From the help output:

    perl convert_to_1p4.pl keepass2 --help
    
    Usage: convert_to_1p4.pl <converter> <options> <export_text_file>
    
    Select a converter:
        clipperz csv dataguardian datavault essentialpim ewallet fsecurekey handysafe ironkeyim
        keepass2 keepassx keeper keychain lastpass licensekeeper msecure nortonis onepif2html
        passpack passwordagent passworddepot passwordsafe passwordsplus passwordwallet roboform
        safeincloud safewallet spbwallet splashid stickypassword txt2notes vcard wallet4
    
    options:
        -a or --addfields          # add non-stock fields as custom fields
        -d or --debug              # enable debug output
        -e or --exptypes <list>    # comma separated list of one or more export types from list below
        -f or --folders            # create and assign items to folders
        -h or --help               # output help and usage text
        -i or --imptypes <list>    # comma separated list of one or more import types from list below
        -m or --modified           # set item's last modified date
        -o or --outfile <ofile>    # use file named ofile.1pif as the output file
        -t or --tags <list>        # add one or more comma-separated tags to the record
        -v or --verbose            # output operations more verbosely
              --nowatchtower       # do not set creation date for logins to trigger Watchtower checks
    
    supported import types:
        login note
    supported export types:
        login note
    

    So, you provide a full path as the < export_text_file > name (which probably needs double-quoting) as in:

     "c:\some\very long\path\to\your\keepass2_exportfile.xml"
    

    The README.pdf explains all of this, and provides you with detailed instructions for doing the export, conversion, and import.

  • ThePhantom
    ThePhantom
    Community Member
    Options

    I installed activeperl and strawberry, then copied the keepass2.pm file into perl64/lib and perl64/lib/xml the syntax i am using is
    O:>perl convert_to_1p4.pl keepass2.pm -v ..\1Pconvert.xml but it comes back with:

    O:>perl convert_to_1p4.pl keepass2.pm -v ..\1Pconvert.xml
    Invalid converter specified
    Usage: convert_to_1p4.pl

    Select a converter:
    clipperz csv dataguardian datavault essentialpim ewallet fsecurekey handysafe ironkeyim
    keepass2 keepassx keeper keychain lastpass licensekeeper msecure nortonis onepif2html
    passpack passwordagent passworddepot passwordsplus passwordwallet roboform safeincloud
    safewallet spbwallet splashid txt2notes vcard

    So what am i supposed to do. place the file anywhere else and is that the right syntax? This is so time consuming. many of the password managers i owned in the past did all this. Safeincloud i was using before. But has no wifi syncing.
    Thanks

  • MrC
    MrC
    Volunteer Moderator
    edited March 2016
    Options

    @ThePhantom,

    It's best to follow the README. You're using ActivePerl, which I abandon a while ago in favor of Strawberry Perl. It will probably still work, but I haven't documented all that you need to make it work (module installation, etc.). You don't need to do all the things you're doing.

    To specify a converter, just supply the converter's name, and not the file's name (e.g. keepass2 vs. keepass2.pm).

    I don't work for AgileBits, so can't speak for them. I provide the converters as a convenience to nice folks like yourself, to save you time, but that can only happen if you follow the step-by-step directions I've carefully crafted to make the process as painless and as reliable as possible.

    As far as I know, there are no other password managers (with the exception of perhaps KeePass2 and its community-supported conversion plug-ins) that natively support conversion for dozens of password managers, with the fidelity I'm providing in the converter suite.

  • ThePhantom
    ThePhantom
    Community Member
    Options

    Well it finally did convert it. but it did not put it into the groups i had it in. I have tried others that can do 15+ conversions. The feature i wish they would add that some others have are ability to change the group a card is in. All showed up in login. i needed them in other grouping. Thanks for all the help

This discussion has been closed.