« [Adobe] HUM.dylibのバージョンを取得する | トップページ | [XML]XMLデータを読み込む »

[TCC]CodeRequirement

com.apple.TCC.configuration-profile-policy

アプリ部分を作成

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


この部分

<dict>

    <key>Allowed</key>

    <true/>

    <key>Identifier</key>

    <string>org.mozilla.firefox</string>

    <key>IdentifierType</key>

    <string>bundleID</string>

    <key>Comment</key>

    <string>Services org.mozilla.firefox</string>

    <key>CodeRequirement</key>

    <string>anchor apple generic and certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or 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] = "43AQ936H96"</string>

    <key>StaticCode</key>

    <true/>

</dict>



#!/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<true/>\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

|

« [Adobe] HUM.dylibのバージョンを取得する | トップページ | [XML]XMLデータを読み込む »

Admin Mobileconfig」カテゴリの記事

Admin Device Management」カテゴリの記事