« [TCC.db]zoomインストールとTCC.db操作のサンプル | トップページ | [Wifi]Wifiアクセスポイント用のmobileconfigを作成する »

[TCC.db] ローカルドメインのtcc.dbを操作する

/Library/Application Support/com.apple.TCC/TCC.db を操作します
要管理者権限になります。

ダウンロード - tcc.db.local.scpt.zip




ユーザードメインのカメラ マイク 音声 をONにして
ローカルドメインのフルディスクアクセス 画面収録 アクセシビリティをONにします。

Screencapture_1316x1154_202111012148482



(************************************************************************
この上の▶︎をぽっちっとしてください

TCC.dbに選択したアプリを登録します
登録するのは
ユーザードメイン
カメラ マイク 音声認識です。
ローカルドメイン
フルディスクアクセス スクリーンキャプチャ アクセシビリティ をONにします
20211101 初回作成

************************************************************************)
set theCommandText to ("id -un") as text
set theUserName to (do shell script theCommandText) as text
try
tell application "Finder"
activate
set objDialog to (display dialog "要管理者権限パスワード" default answer "" with title "このMacのログインパスワード" with hidden answer)
end tell
set theAdminPassWord to (text returned of objDialog) as text
on error
"パスワードを取得できませんでした"
return
end try
########################################################


set theCommandText to ("id -un") as text
set theUserName to (do shell script theCommandText) as text


tell application "Finder"
set aliasChooseApp to (choose file "test" with prompt "" of type {"APPL"} default location "/Applications" with multiple selections allowed without showing package contents) as list
end tell

set numCntAppList to (count of aliasChooseApp) as number
set numCntApp to 1 as number

repeat numCntAppList times
set theLineAPP to (item numCntApp of aliasChooseApp) as alias
set theFileInfo to info for theLineAPP as list

tell theFileInfo
set theBundleIdentifier to (bundle identifier as list) as text
end tell
########################################################
try
set theCommandText to ("/usr/bin/tccutil reset Camera " & theBundleIdentifier & "") as text
do shell script theCommandText
delay 0.5
end try
try
set theCommandText to ("/usr/bin/tccutil reset Microphone " & theBundleIdentifier & "") as text
do shell script theCommandText
delay 0.5
end try
try
set theCommandText to ("/usr/bin/tccutil reset SpeechRecognition " & theBundleIdentifier & "") as text
do shell script theCommandText
delay 0.5
end try
########################################################
try
set theCommandText to ("/usr/bin/sudo /usr/bin/tccutil reset SystemPolicyAllFiles " & theBundleIdentifier & "") as text
do shell script theCommandText user name theUserName password theAdminPassWord with administrator privileges
delay 0.5
end try
try
set theCommandText to ("/usr/bin/sudo /usr/bin/tccutil reset ScreenCapture " & theBundleIdentifier & "") as text
do shell script theCommandText user name theUserName password theAdminPassWord with administrator privileges
delay 0.5
end try
try
set theCommandText to ("/usr/bin/sudo /usr/bin/tccutil reset Accessibility " & theBundleIdentifier & "") as text
do shell script theCommandText user name theUserName password theAdminPassWord with administrator privileges
delay 0.5
end try
########################################################
try
set theCommandText to ("/usr/bin/sudo /usr/bin/sqlite3 /Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceSystemPolicyAllFiles','" & theBundleIdentifier & "',0,2,2,1, NULL,NULL,NULL,'UNUSED',NULL,0,1606059851);\"") as text
do shell script theCommandText user name theUserName password theAdminPassWord with administrator privileges
delay 0.5
end try
try
set theCommandText to ("/usr/bin/sudo /usr/bin/sqlite3 /Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceScreenCapture','" & theBundleIdentifier & "',0,2,2,1, NULL,NULL,NULL,'UNUSED',NULL,0,1606059851);\"") as text
do shell script theCommandText user name theUserName password theAdminPassWord with administrator privileges
delay 0.5
end try
try
set theCommandText to ("/usr/bin/sudo /usr/bin/sqlite3 /Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceAccessibility','" & theBundleIdentifier & "',0,2,2,1, NULL,NULL,NULL,'UNUSED',NULL,0,1606059851);\"") as text
do shell script theCommandText user name theUserName password theAdminPassWord with administrator privileges
delay 0.5
end try
########################################################
try
set theCommandText to ("/usr/bin/sqlite3 /Users/" & theUserName & "/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceCamera','" & theBundleIdentifier & "',0,2,2,1, NULL,NULL,NULL,'UNUSED',NULL,0,1606059851);\"") as text
do shell script theCommandText
delay 0.5
end try
try
set theCommandText to ("/usr/bin/sqlite3 /Users/" & theUserName & "/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceMicrophone','" & theBundleIdentifier & "',0,2,2,1, NULL,NULL,NULL,'UNUSED',NULL,0,1606059851);\"") as text
do shell script theCommandText
delay 0.5
end try
try
set theCommandText to ("/usr/bin/sqlite3 /Users/" & theUserName & "/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceSpeechRecognition','" & theBundleIdentifier & "',0,2,2,1, NULL,NULL,NULL,'UNUSED',NULL,0,1606059851);\"") as text
do shell script theCommandText
delay 0.5
end try

set numCntApp to numCntApp + 1 as number
end repeat

set theCommandText to ("open \"x-apple.systempreferences:com.apple.preference.security?Privacy_SpeechRecognition\"") as text
do shell script theCommandText

|

« [TCC.db]zoomインストールとTCC.db操作のサンプル | トップページ | [Wifi]Wifiアクセスポイント用のmobileconfigを作成する »

TCC.db」カテゴリの記事