roddhjav / pass-import

A pass extension for importing data from most existing password managers
https://www.passwordstore.org/
GNU General Public License v3.0
805 stars 88 forks source link

aegis import encrypted json #187

Closed janpeterd closed 6 months ago

janpeterd commented 1 year ago

Hi, I encounter issues when importing an encrypted export from Aegis to pass with pass-import. I did install the cryptography python-module via pip.

command: pass import aegis /path/to/aegis-export.json

output:

w  'str' object has no attribute 'get'
[x] Error: /path/to/aegis-export.json is not a valid exported aegis file.

However a non-encrypted export from aegis works fine.

roddhjav commented 1 year ago

Hi, Could you post the output with the -vvv option enabled. Also could you confirm your json file has the same format that this one: https://github.com/roddhjav/pass-import/blob/master/tests/assets/db/aegiscipher.json

janpeterd commented 1 year ago

Command: pass import -vvv aegis /path/to/aegis-export.json

Output:

  .  Trying to guess file format.
  .  Importer: aegis, Format: json, Version:
  .  Importing passwords from Aegis to PasswordStore
  .  Checking for breached passwords
  .  Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pass_import/__main__.py", line 354, in pass_import
    importer.parse()
  File "/usr/lib/python3.10/site-packages/pass_import/managers/aegis.py", line 59, in parse
    for item in self.content.get('entries', []):
AttributeError: 'str' object has no attribute 'get'

My json format looks like this (I removed most of the values):

{
    "version": 1,
    "header": {
        "slots": [
            {
                "type": 1,
                "uuid": "",
                "key": "",
                "key_params": {
                    "nonce": "",
                    "tag": ""
                },
                "n": 32768,
                "r": 8,
                "p": 1,
                "salt": "",
                "repaired": true
            },
            {
                "type": 2,
                "uuid": "",
                "key": "",
                "key_params": {
                    "nonce": "",
                    "tag": ""
                }
            }
        ],
        "params": {
            "nonce": "",
            "tag": ""
        }
    },
    "db": ""
}
roddhjav commented 1 year ago

Thanks for these information. It is indeed an issue in the format detection process. The following will work: pass import /path/to/aegis-export.json -vvvf, but not pass import aegis /path/to/aegis-export.json -vvvf

I will fix it shortly.

janpeterd commented 1 year ago

That works perfectly, thanks!