« [Link]Device Management | トップページ | [Automator]Visual Studio Codeで開く »

[AppleScript]com.apple.TCC.configuration-profile-policyの作成補助

com.apple.TCC.configuration-profile-policyの
↓この部分を作成します

                        <dict>

                            <key>Allowed</key>

                            <true/>

                            <key>Identifier</key>

                            <string>com.tinyspeck.slackmacgap</string>

                            <key>IdentifierType</key>

                            <string>bundleID</string>

                            <key>Comment</key>

                            <string>Services com.tinyspeck.slackmacgap</string>

                            <key>CodeRequirement</key>

                            <string>identifier "com.tinyspeck.slackmacgap" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = BQR82RBBHL</string>

                        </dict>


ダウンロード - coderequirement.scpt.zip


#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# 
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7


use framework "Foundation"
use AppleScript version "2.4"
use scripting additions
property objMe : a reference to current application
property objNSString : a reference to objMe's NSString


set aliasFile to (choose file with prompt "Appを選んでください" default location (path to applications folder from user domain) of type {"com.apple.application-bundle"} with invisibles without showing package contents and multiple selections allowed) as alias

tell application "Finder"

set objInfo to info for aliasFile
set strAppPath to POSIX path of aliasFile

set strUTI to bundle identifier of objInfo

end tell
set objCapText to objNSString's stringWithString:strUTI
set strCapText to (objCapText's lowercaseString()) as string

set strcodesign to (do shell script "codesign -dr - \"" & strAppPath & "\"") as text
set strcodesign to doReplace(strcodesign, "designated => ", "")
set strcodesign to doReplace(strcodesign, "(", "")
set strcodesign to doReplace(strcodesign, ")", "")


##set strTCC to "<dict>\n<key>Allowed</key><true/>\n<key>Identifier</key>\n<string>" & strCapText & "</string>\n<key>IdentifierType</key>\n<string>bundleID</string>\n<key>Comment</key>\n<string>Services " & strCapText & "</string>\n<key>CodeRequirement</key>\n<string>" & strcodesign & "</string>\n<key>StaticCode</key>\n<false/>\n</dict>\n"


set strTCC to "<dict>\n<key>Allowed</key><true/>\n<key>Identifier</key>\n<string>" & strCapText & "</string>\n<key>IdentifierType</key>\n<string>bundleID</string>\n<key>Comment</key>\n<string>Services " & strCapText & "</string>\n<key>CodeRequirement</key>\n<string>" & strcodesign & "</string>\n</dict>\n"

set the clipboard to strTCC as text

to doReplace(theText, orgStr, newStr)
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to orgStr
set tmpList to every text item of theText
set AppleScript's text item delimiters to newStr
set tmpStr to tmpList as text
set AppleScript's text item delimiters to oldDelim
return tmpStr
end doReplace

|

« [Link]Device Management | トップページ | [Automator]Visual Studio Codeで開く »

TCC」カテゴリの記事

Admin Mobileconfig」カテゴリの記事

Admin Device Management」カテゴリの記事

Slack」カテゴリの記事