mh- / corona-warn-companion-android

Android App Which Shows Details about CWA Exposures (Requires Root or CCTG or RaMBLE Apps)
GNU General Public License v3.0
130 stars 22 forks source link

Any way without root? #129

Open stephan-strate opened 2 years ago

stephan-strate commented 2 years ago

Is there any way to export or read existing data from the official "Corona Warn App" without root?

lukalt commented 2 years ago

No, this is not possible as the database is protected and can be only accessed by the app itself.
You could switch to the CCTG app (https://f-droid.org/de/packages/de.corona.tracing/), which is a fork on the official "Corona Warn App". This fork allows you to export the internal database and to send it to the Warn App Companion. Please note that this only works for possible exposures in the future, for exposures in the past, the only way to access the information is using root privileges.

LukasGibeh commented 2 years ago

Even with a phone that is not rooted it should be possible to copy the data from the database path to some user-accessible directory. The companion could then read it from there.

I am running LineageOS (without root) and accessed the files via the TWRP recovery and adb shell/adb pull.

@mh- Do you think an option to manually import the DB would be feasible?

mh- commented 2 years ago

I'm trying to keep the options as simple as possible. If you use Lineage OS, why not also use the CCTG app?

LukasGibeh commented 2 years ago

I definitely realized too late that this app (CCTG) event existed. So for the past data that's unfortunately too late for me :(

mh- commented 2 years ago

Database import for RaMBLE is now implemented. Maybe this can be expanded to your request as well.

tobidwest commented 2 years ago

Hi everyone, I just came across this issue looking for a documentation on how to get data from CWA via adb. I think this would be a good option to add, running adb commands isn‘t that difficult and prevents the loss of old exposure records.

I don’t have deep knowledge of adb though. @LukasGibeh, could you share the command you used? Does it work while the system is running too or do you need a custom recovery to be able to obtain the needed priviligues? Thanks

LukasGibeh commented 2 years ago

Hi @tobidwest,

I didn't check whether the directory that is mentioned in the code is really containing the exposure records. I assume that they are in Google's protobuf format.

For me, it works as follows:

  1. Enable "Android Debugging"/"USB Debugging" in Android's Developer options.
  2. Enable "Rooted Debugging", too. (I don't know whether this options exists in a stock ROM. I'm running a custom ROM which is, however, not rooted.)
  3. adb devices should then show your phone (as "unauthorized")
  4. Accept the pop-up message that's showing up on your phone -> adb devices will then recognize your phone properly
  5. adb root
  6. adb pull /data/data/com.google.android.gms/app_contact-tracing-contact-record-db/
tobidwest commented 2 years ago

Thank you, @LukasGibeh

As far as I know, adb root doesn't work with a stock rom but one can add ro.debuggable=1 to the file /system/build.prop However, this might go too far for the intended purpose