Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: run the script unsupervised #1

Closed
vojeroen opened this issue Nov 21, 2021 · 6 comments
Closed

feature request: run the script unsupervised #1

vojeroen opened this issue Nov 21, 2021 · 6 comments

Comments

@vojeroen
Copy link

Hi,

I'm looking to set up a daily export from Bitwarden to a kdbx file, for which your scripts seems to be good tool. However, for the daily job I have in mind, there are a few modifications required. I'd like to check with you how you prefer this: (a) I can fork your repo and just do my modifications, you don't need to be bothered by it; (b) I can send you a PR with some modifications; (c) I can let you know my feature request and you have a look.

This are the modifications I'm thinking about:

  1. Get the master password from an environment variable, and only request user input if the environment variable is not set.
  2. Currently the script crashes if it finds two items in the same folder with the same name. Some better exception handling of this would be nice, i.e. appending "copy1" or something to the name in case this happens.

Kind regards,

@k3karthic
Copy link
Owner

Hi,

Thanks for the feedback. I've pushed an update which will allow you to specify the password in the environment variable BITWARDEN_PASS.

I tried creating two entries with the same name but the script does not throw an error. Could you send me a screenshot of the error you're getting? Please feel free to send a PR if that's easier for you.

OS: Debian Buster
Python: v3.7.3
pykeepass: v4.0.1
BitWarden CLI: v1.19.1

image

Regards,

@vojeroen
Copy link
Author

vojeroen commented Nov 21, 2021

Thanks k3karthic for the quick response on the environment variable!

About the two entries, let me show you; this is my Bitwarden vault:
afbeelding

It gives this output:

Traceback (most recent call last):
  File "/app/convert.py", line 133, in <module>
    convert(args.Output)
  File "/app/convert.py", line 114, in convert

Fetching folders...
Fetching items...

    kp.add_entry(
  File "/usr/local/lib/python3.9/site-packages/pykeepass/pykeepass.py", line 613, in add_entry
    raise Exception(
Exception: An entry "EntryForTest" already exists in "Group: """

When I remove one of the entries, it works as expected.

Running in a Docker container with:

  • Debian Buster
  • Python 3.9
  • pykeepass 4.0.1
  • BW CLI 1.19.1

@vojeroen
Copy link
Author

Hi,

Some more insights : it appears to only occur if both the name of the entry and the usernames are identical. So it is possibly a relatively rare use care. Still it might be more interesting to output a kdbxfile without the conflicting entries (and showing a warning or error) than no file at all. Or possibly let the user choose the behaviour with e.g. a --fail-on-error=true/false flag or similar. I'll leave it up to you to see if and how you want to handle this.

For my part, I renamed the conflicting entries so no problem anymore.

@k3karthic
Copy link
Owner

Hi vojeroen,

Thank you for taking the time to look into this. convert.py is a backup script and I would like to avoid dropping credentials without warning.

I like your idea of resolving the conflict by appending a sequential suffix like "copy 1". I'll implement it sometime this week.

Regards,

@k3karthic
Copy link
Owner

k3karthic commented Dec 5, 2021

I've released v0.1.3 which adds a suffix like “<name> (1)” to the title for duplicate entries.

@vojeroen
Copy link
Author

I'll give it a go, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants