Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Grant the location permission to an iOS app. More permissions here:
# Todo: This currently fails to replace an existing entry in the location permission database. Would be better add to the end of the clients.plist file.
# Usage:./ [bundleId]
# Example: ./ com.spotify.client
# Requirements:
# - iOS device with checkra1n jailbreak (tested on 14.8)
# - 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`
if [ -z "$1" ]; then
echo "Please pass bundleId"
exit -1
# Get bundleId from argument (e.g. cn.DGNorya.Norya)
# Create backup (-n makes sure to not overwrite existing backup)
ssh -T -p 2222 root@localhost "cp -n /private/var/root/Library/Caches/locationd/clients.plist ~/clients.backup.plist"
# Get path to executable from install logs
executable=`ssh -T -p 2222 root@localhost "cat /private/var/installd/Library/Logs/MobileInstallation/mobile_installation.log.* | grep 'Made container live for $bundleId at /private/var/containers/Bundle/Application/' | sort | tail -n1"`
executable=${executable##*Made container live for $bundleId at }
executable=`ssh -T -p 2222 root@localhost "find $executable/*.app/ -maxdepth 1 -perm -111 -type f -exec readlink -f {} \;"`
# Download binary plist file
scp -P 2222 root@localhost:/private/var/root/Library/Caches/locationd/clients.plist ./clients.old.plist
# Cleanup if exists
rm ./ || true
# Add to downloaded binary plist file
echo "`plistutil -i ./clients.old.plist -o -`" | while read p ; do
echo "$p" >> ./
if [[ "$p" =~ '<dict>' && $n = 0 ]]; then
echo "<key>$bundleId</key>
</dict>" >> ./
# Convert plist back to binary
plistutil -i ./ -o ./
echo "Created new clients configuration at ./"
echo "Now copy this file to your device, as described here:"
# Stop location service
#ssh -T -p 2222 root@localhost "launchctl unload /System/Library/LaunchDaemons/"
#sleep 1
# Copy over new plist file
#scp -P 2222 ./ /private/var/root/Library/Caches/locationd/clients.plist
# Start location service
#ssh -T -p 2222 root@localhost "launchctl load /System/Library/LaunchDaemons/"
# Cleanup
#rm ./
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment