Skip to content

Instantly share code, notes, and snippets.

@kasnder
Last active May 26, 2023 16:35
Show Gist options
  • Save kasnder/3eb32449512a4dba4a92949c8d337a92 to your computer and use it in GitHub Desktop.
Save kasnder/3eb32449512a4dba4a92949c8d337a92 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage:./grant_ios_permissions.sh [bundleId]
# Example: ./grant_ios_permissions.sh com.spotify.client
echo "This does not grant location, notification or local network permission. You can grant location permission with this script https://gist.github.com/kasnder/91a64a555e962d08cd05b52f7114b897 and the notifications permission with this script https://gist.github.com/kasnder/c17752607486042fc4f8bd4f61bb2c43 and local network permission with this script https://gist.github.com/kasnder/7076fe8eaea51948e5cda7a01e343ff5"
# Requirements:
# - iOS 14.8 device with checkra1n jailbreak
# - Installed `sqlite3` on iOS device from Cydia
# - iOS device plugged into computed and forwarded SSH port with `iproxy 2222 44`
# - Installed public ssh key on your device: `ssh-copy-id -p 2222 root@localhost`
# Some more information for the iOS simulator can be found here: https://github.com/wix/AppleSimulatorUtils/blob/master/applesimutils/applesimutils/SetNotificationsPermission.m
if [ -z "$1" ]; then
echo "Please pass bundleId"
exit -1
fi
ssh -T -p 2222 root@localhost << EOF
# List taken on iOS 14.8 device from /System/Library/PrivateFrameworks/TCC.framework/en.lproj/Localizable.strings
for permission in kTCCServiceExposureNotification kTCCServiceFallDetection kTCCServiceGameCenterFriends kTCCServiceSensorKitBedSensingWriting kTCCServiceUserTracking kTCCServiceSiri kTCCServiceSpeechRecognition kTCCServiceAddressBook kTCCServiceBluetoothAlways kTCCServiceBluetoothPeripheral kTCCServiceBluetoothWhileInUse kTCCServiceCalendar kTCCServiceCalls kTCCServiceCamera kTCCServiceContactsFull kTCCServiceContactsLimited kTCCServiceMediaLibrary kTCCServiceMicrophone kTCCServiceMotion kTCCServicePhotosAdd kTCCServiceReminders kTCCServiceWillow; do
echo "INSERT INTO access VALUES('\$permission','$1',0,2,2,1,NULL,NULL,NULL,'UNUSED',NULL,0,"\`date +%s\`");" >> ./grant_permissions.sql
done
echo "INSERT INTO access VALUES('kTCCServicePhotos','$1',0,2,2,2,NULL,NULL,NULL,'UNUSED',NULL,0,"\`date +%s\`");" >> ./grant_permissions.sql
# Make sure to install sqlite3 on your device
sqlite3 /private/var/mobile/Library/TCC/TCC.db < ./grant_permissions.sql
# Cleanup
rm ./grant_permissions.sql
EOF
echo "Granted permissions!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment