Sunday, January 27, 2019

Modify Android Permissions with ADB

First:
Lets get a list of permissions:
./adb shell pm list permissions -d -g


Second:
Query against each permission:
./adb shell cmd appops query-op {X} allow | sort
./adb shell cmd appops query-op {X} default | sort
Where {X} is the Permission Name. Example:
./adb shell cmd appops query-op READ_SMS allow | sort

Third:
Change the permission for a specific package:
./adb shell cmd appops set {Y} {X} ignore
Where {Y} is the package name, {X} is the Permission Name. Example:
 ./adb shell cmd appops set com.whatsapp WRITE_CONTACTS ignore

Fourth:
Some important permissions you need to change:
VIBRATE
RUN_IN_BACKGROUND
WRITE_SETTINGS
PICTURE_IN_PICTURE
WIFI_SCAN
CAMERA
USE_FINGERPRINT
MONITOR_LOCATION
MONITOR_HIGH_POWER_LOCATION
TOAST_WINDOW
READ_EXTERNAL_STORAGE
WRITE_EXTERNAL_STORAGE

Thursday, January 3, 2019

Create a Disk Image & Restore It (Mojave / APFS)

First of all, Apple you SUCK!!!

Now, that's out of the way, here is how to create a disk image for APFS and restore it:

  • Boot Mojave from an external USB (CMD + Option)
  • Open Terminal
    • Unmount the disk (disk0 is the built-in disk):
      • diskutil unmountDisk /dev/disk0
    • Create the image:
      • hdiutil create -srcdevice /dev/disk0s2 -format UDZO /Volumes/100G/Macintosh_HD_Backup.dmg
    • Scan the image
      • asr imagescan --source /Volumes/100G/Macintosh_HD_Backup.dmg
    • Restore the image
      • asr restore --source /Volumes/100G/Macintosh_HD_Backup.dmg --target /dev/disk0s2 --erase
      • When it asks to restore it to disk1, APFS, say 'y'.