diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c9b8d59 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*._* +tccPlus.dmg diff --git a/README.md b/README.md index 9f3e540..98eea76 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ I never recommend manually modifying any system database because if a mistake is Requires SIP and AMFI to be disabled. -Currently can only add one or all (not recommended) services at a time. Using `reset All` is fine. +Fixed adding, resetting multiple services at a time. (Command Click to select multiple services) Currently, script runs separate commands for each service. ``` tccplus [add/reset] SERVICE [BUNDLE_ID] @@ -49,3 +49,9 @@ Services: - Ubiquity - Willow ``` +Usage Example: +Run AppleScript. +Select Application. +Select services. +Select whether to add, reset service(s). +PROFIT! diff --git a/tccplus.applescript b/tccplus.applescript index c69a1a8..1e7b9fe 100644 --- a/tccplus.applescript +++ b/tccplus.applescript @@ -1,6 +1,8 @@ # Applescript Initially created by Will http://junebeetle.github.io/ # Modified by Ben https://github.com/plessbd/ +# Further modified to support 'reset' functionality for tccplus by FreQRiDeR/ # Uses tccplus https://github.com/jslegendre/tccplus/ + to getHomePath() do shell script "echo ~" end getHomePath @@ -41,22 +43,25 @@ repeat with outputLine in paragraphs of result end if end repeat -choose file of type "app" with prompt "Choose an application to add privileges." default location strAppPath +choose file of type "app" with prompt "Choose an application to modify privileges." default location strAppPath set appPath to POSIX path of result -choose from list serviceNames with prompt "Choose privileges to add." with multiple selections allowed +choose from list serviceNames with prompt "Choose services to modify." with multiple selections allowed set services to result +display dialog "Do you want to ADD or RESET the selected services?" buttons {"Cancel", "Reset", "Add"} default button 3 cancel button 1 +set actionChoice to button returned of result +set actionChoice to (do shell script "echo " & quoted form of actionChoice & " | tr '[:upper:]' '[:lower:]'") + do shell script "defaults read " & quoted form of (appPath & "/Contents/Info.plist") & " CFBundleIdentifier" set appID to result set command to "" repeat with service in services - set command to command & quoted form of toolPath & " add " & service & " " & appID & ";" + set command to command & quoted form of toolPath & " " & actionChoice & " " & service & " " & appID & ";" end repeat -# set command to quoted form of toolPath & " add " & service & " " & appID display dialog "The following commands will be run. Is that okay?" buttons {"Cancel", "Run"} default answer command cancel button 1 default button 2 tell application "Terminal" diff --git a/wrapper.sh b/wrapper.sh deleted file mode 100755 index 22679a9..0000000 --- a/wrapper.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -ACTIONS=("add reset") -ALLOWEDSERVICES=("All Accessibility AddressBook AppleEvents Calendar Camera ContactsFull ContactsLimited DeveloperTool Facebook LinkedIn ListenEvent Liverpool Location MediaLibrary Microphone Motion Photos PhotosAdd PostEvent Reminders ScreenCapture ShareKit SinaWeibo Siri SpeechRecognition SystemPolicyAllFiles SystemPolicyDesktopFolder SystemPolicyDeveloperFiles SystemPolicyDocumentsFolder SystemPolicyDownloadsFolder SystemPolicyNetworkVolumes SystemPolicyRemovableVolumes SystemPolicySysAdminFiles TencentWeibo Twitter Ubiquity Willow") - -PLISTFILE=$1/Contents/Info.plist - -if [ ! -f $PLISTFILE ]; then - echo 'Application PList $PLISTFILE not found' - exit 1 -fi -if [[ ! " ${ACTIONS[@]} " =~ " $2 " ]]; then - echo "Action ($2) not allowed" - exit 2 -fi -BUNDLE=`awk '/CFBundleIdentifier/{getline; print}' $PLISTFILE | awk -F '[<>]' '/string/{print $3}'` - - -IFS=',' read -ra SERVICES <<< "$3" - -echo "RUN THE FOLLOWING:" -for SERVICE in "${SERVICES[@]}" -do - if [[ ! " ${ALLOWEDSERVICES[@]} " =~ " $SERVICE " ]]; then - #echo "Service ($SERVICE) not allowed, skipping" - continue - fi - echo tccplus $2 $SERVICE $BUNDLE -done