-
-
Save jonathanweinberg/ad227ef90353e363a75279ef05c89899 to your computer and use it in GitHub Desktop.
Revisions
-
timsutton revised this gist
Mar 24, 2022 . 1 changed file with 38 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,43 @@ #!/bin/bash # A cleaner alternative to this approach, but which requires a restart, is to populate TCC's SiteOverrides.plist inside # the TCC app support directory with the following: # <?xml version="1.0" encoding="UTF-8"?> # <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> # <plist version="1.0"> # <dict> # <key>Services</key> # <dict> # <key>PostEvent</key> # <array> # <dict> # <key>Allowed</key> # <true/> # <key>CodeRequirement</key> # <string>identifier "com.apple.screensharing.agent" and anchor apple</string> # <key>Identifier</key> # <string>com.apple.screensharing.agent</string> # <key>IdentifierType</key> # <string>bundleID</string> # </dict> # </array> # <key>ScreenCapture</key> # <array> # <dict> # <key>Allowed</key> # <true/> # <key>CodeRequirement</key> # <string>identifier "com.apple.screensharing.agent" and anchor apple</string> # <key>Identifier</key> # <string>com.apple.screensharing.agent</string> # <key>IdentifierType</key> # <string>bundleID</string> # </dict> # </array> # </dict> # </dict> # </plist> set -eux -o pipefail db_path="/Library/Application Support/com.apple.TCC/TCC.db" -
timsutton revised this gist
Dec 16, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,7 +49,7 @@ sqlite3 "${db_path}" \ "SELECT * FROM access WHERE client = 'com.apple.screensharing.agent';" } # uncomment to show existing entries for debugging # dump_screensharing_entries sanity_checks -
timsutton revised this gist
Dec 16, 2021 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,6 +49,12 @@ sqlite3 "${db_path}" \ "SELECT * FROM access WHERE client = 'com.apple.screensharing.agent';" } # uncomment this to show existing entries # dump_screensharing_entries sanity_checks enable_screensharing # uncomment to disable instead of enable # disable_screensharing -
timsutton revised this gist
Nov 12, 2021 . 1 changed file with 12 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,34 +20,33 @@ sanity_checks() { # for whatever is the protection for TCC) } disable_screensharing() { launchctl unload -w /System/Library/LaunchDaemons/com.apple.screensharing.plist sqlite3 "${db_path}" \ "BEGIN TRANSACTION; \ DELETE FROM access WHERE client = 'com.apple.screensharing.agent'; \ COMMIT;" } enable_screensharing() { launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist epoch="$(date +%s)" sqlite3 "${db_path}" \ "BEGIN TRANSACTION; \ DELETE FROM access WHERE client = 'com.apple.screensharing.agent'; \ COMMIT; \ BEGIN TRANSACTION; \ INSERT INTO access VALUES('kTCCServicePostEvent','com.apple.screensharing.agent',0,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,${epoch}); \ INSERT INTO access VALUES('kTCCServiceScreenCapture','com.apple.screensharing.agent',0,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,${epoch}); \ COMMIT;" } dump_screensharing_entries() { sqlite3 "${db_path}" \ "SELECT * FROM access WHERE client = 'com.apple.screensharing.agent';" } sanity_checks -
timsutton revised this gist
Nov 12, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,6 +16,8 @@ sanity_checks() { exit 1 fi # TODO: we should bail if we determine we don't have write access to the TCC db (we want to get specific SIP disable status # for whatever is the protection for TCC) } -
timsutton created this gist
Nov 12, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ #!/bin/bash set -eux -o pipefail db_path="/Library/Application Support/com.apple.TCC/TCC.db" sanity_checks() { os_ver_major="$(sw_vers -productVersion | awk -F'.' '{print $1}')" if [[ "${os_ver_major}" -ne 12 ]]; then echo "This script is only tested valid on macOS 12, and we detected this system runs version ${os_ver_major}. Exiting." exit 1 fi if [[ "$(id -u)" -ne 0 ]]; then echo "Need to run this script as root... exiting" exit 1 fi } disable_screensharing() { launchctl unload -w /System/Library/LaunchDaemons/com.apple.screensharing.plist sqlite3 "${db_path}" \ "BEGIN TRANSACTION; \ DELETE FROM access WHERE client = 'com.apple.screensharing.agent'; \ COMMIT;" } enable_screensharing() { launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist epoch="$(date +%s)" sqlite3 "${db_path}" \ "BEGIN TRANSACTION; \ DELETE FROM access WHERE client = 'com.apple.screensharing.agent'; \ COMMIT; \ BEGIN TRANSACTION; \ INSERT INTO access VALUES('kTCCServicePostEvent','com.apple.screensharing.agent',0,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,${epoch}); \ INSERT INTO access VALUES('kTCCServiceScreenCapture','com.apple.screensharing.agent',0,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,${epoch}); \ COMMIT;" } dump_screensharing_entries() { sqlite3 "${db_path}" \ "SELECT * FROM access WHERE client = 'com.apple.screensharing.agent';" } sanity_checks disable_screensharing