bpellin / keepassdroid

KeePass implementation for android
http://www.keepassdroid.com
Other
1.38k stars 346 forks source link

Location of local keepassdroid db in Android 9 (Pie) #382

Open ghost opened 4 years ago

ghost commented 4 years ago

Specifications: I am using the kbx version 2 db. Keepassdroid version 2.4.1 Android version 9 (Pie) Phone: Motorola One (MotoX4)

Phone: there is no SD card, but the OS emulates one to save files for KeepassDroid. Link: https://stackoverflow.com/questions/31399122/how-to-access-storage-emulated-0

I have discovered that the most up-to-date copy of my db is a local version on my phone, instead of google drive. (Ugh.) There is no option to export or save the file currently in use, so I'll have to browse to find it and upload it back to my google drive.

If I use file explorer to find the file, where is the keepassdroid local db path in Android 9 (Pie)?

I've looked on the path to the current db when you open keepassdroid, but the path is cut off instead of word-wrapped.... KeePass database filename: content://com.google.android.apps.do...

If I go to "Open recent database (click to open)" if the first one in the list is the last one I used, the address should be: content://com.google.android.apps.docs.storage/document/acc%3D1%3Bdoc%3D5869

However, if I try to browse to this using file explorer, I can't find it.

At the bottom, on the same screen it shows "Enter Database Filename" and has prefilled: /storage/emulated/0/keepass/keepass.kdbx (icon to browse folders)

This is the type of path I'm used to seeing, and can use file explorer to open and upload to google drive. However, if I try to open this file, keepassdroid says: File not found.

If I try to open the path mentioned earlier with no *.kbdx filename at the end, it opens.

Your help is greatly appreciated.

kanytu commented 4 years ago

Hi,

I would say this is intended. You have to start the picker every time you want to import the DB from a content provider URI. I might be wrong, but the app is not taking persistent permissions over the URI, which means that, for security reasons, the app has access to the content of that file for a limite amount of time.

So, when using content URIS (content://) such as Drive, you will have to manually pick the file again every time you need to change it.

mikejholmes93 commented 4 years ago

@Matilda71 I had the same issue (/ for anyone else who may need to do this), not sure how google's contentprovider interface is setup but I've been able to pull my local stream from the keepassdroid copy stuck on my phone:

  1. Install adb on a device (windows/mac whatever)
  2. Enable developer options / put your phone in USB Debugging mode
  3. Open an adb shell to your phone (adb start-server, adb shell)
  4. Dump the content stream from keepassdroid to a pullable file on the phone (content read --uri content://com.microsoft.skydrive.content.external/Drive/ID/1/Item/RID/..../Passwords.kdbx?externalUriType=GetContent > sdcard/mystuckfile.kdbx) the URI there is basically whatever you see in "Open Recent Database" in the app, ie. content://com.google.android.apps.docs.storage/document/acc%3D1%3Bdoc%3D5869 whatever
  5. Pull the stored file back to windows/mac whatever, open it in the desktop version / resave it in the drive, whatever (exit shell, adb pull /sdcard/mystuckfile.kdbx C:\some\local\path\mystuckfile.kdbx

Good luck, beats copying out your new secrets by hand