星之一角

What have you found for these years?

2018-03-16

Backup Google Authenticator secrets

So I finally rooted my new Pixel 2, transferring over my data,
game saves, and setting up everything including Google Authenticator.
Now the most important step! The very reason why I want to root
my Android, to backup Google Authenticator secrets...

What an awful idea to make it only able to backup with a rooted device.

Here are the steps:

# Enable Developer options on the phone
# Enable USB debugging

# Connect the phone with the computer
$ /usr/local/share/android-sdk/platform-tools/adb shell

walleye:/ $ su
# Grant superuser privilege from the phone screen
# If it's not popping up, and it shows permission denied,
# then go to Magisk app which we used to root, and find
# the option to grant superuser privilege to Shell manually
walleye:/ # cp /data/data/com.google.android.apps.authenticator2/databases/databases /sdcard/Download

# Ctrl-D to leave phone console

$ /usr/local/share/android-sdk/platform-tools/adb pull /sdcard/Download/databases .
$ sqlite3 databases
sqlite> select * from accounts;

# You should see all your secrets!

Of course, remove /sdcard/Download/databases on the phone afterward.
Keep that sqlite3 database in a safe place. (or just copy the secrets and remove it)

References:

* Manually Extract Your Credentials [Root Only]

2018-03-15

Rooting Pixel 2 with MacBook

# Install tools on the computer
$ brew cask install android-sdk
# Install platform-tools in order to have adb
$ sdkmanager platform-tools

# Download official Android image:
# https://developers.google.com/android/images
# Extract everything and find "boot.img"

# Download Magisk (the only 3rd party stuff)
# https://www.apkmirror.com/apk/topjohnwu/magisk-manager/

# Enable Developer options on the phone
# Enable OEM unlocking
# Enable USB debugging

# Connect the phone with the computer

# Check if connected
$ /usr/local/share/android-sdk/platform-tools/adb devices

# Boot to bootloader
$ /usr/local/share/android-sdk/platform-tools/adb reboot bootloader

# Check if fastboot is available
$ /usr/local/share/android-sdk/platform-tools/fastboot devices

# Unlock the bootloader (NOTE: This would WIPE all the data)
# Run it only after backing up
$ /usr/local/share/android-sdk/platform-tools/fastboot flashing unlock

# UNLOCK THE BOOTLOADER

# Reboot the phone
$ /usr/local/share/android-sdk/platform-tools/fastboot reboot

# Setup the phone again
# Enable Developer options on the phone again

# Upload Magisk and "boot.img" to the phone
$ /usr/local/share/android-sdk/platform-tools/adb push 'magisk_5.6.2.apk' /sdcard/Download
$ /usr/local/share/android-sdk/platform-tools/adb push 'boot.img' /sdcard/Download

# Install Magisk from Downloads
# Click "Install", "Patch Boot Image File" and pick "boot.img" from Downloads

# Download the patched_boot.img from the phone to the computer
$ /usr/local/share/android-sdk/platform-tools/adb pull /sdcard/MagiskManager/patched_boot.img

# Reboot to bootloader again
$ /usr/local/share/android-sdk/platform-tools/adb reboot bootloader

# Flash the patched image
$ /usr/local/share/android-sdk/platform-tools/fastboot flash boot patched_boot.img

# Reboot
$ /usr/local/share/android-sdk/platform-tools/fastboot reboot

# All done!

References:

* How to root the Google Pixel 2
* [GUIDE] Unlock/Flash/Root for the Pixel 2 (walleye)

All texts are licensed under CC Attribution 3.0