3 weeks ago
Hi All,
does anyone know/have extension attributes to find installed extension in Safari browser?
3 weeks ago
We don't use this anymore, but we used to use it. Last time we did, it worked fairly well:
#!/usr/local/bin/managed_python3
# Name: safari_extensions.py
# Description: This extension attribute returns a list of the names and
# versions of all Safari add-ons installed for the current
# user. Inspired by the managed_python3 version of Chrome Extensions script by Elliot Jordan <elliot@lindegroup.com>
# Author: Daniel Mortensen <dmortensen@simonsfoundation.org>
# Created: 2022-10-28
# Last Modified: 2022-10-28
# Version: 1.0
import os
import xml.etree.ElementTree as ET
import re
import sys
from SystemConfiguration import SCDynamicStoreCopyConsoleUser
def get_current_user():
username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]
return username
def get_extensions(username):
extensions_list = ("/Users/%s/Library/Containers/com.apple.Safari/"
"Data/Library/Safari/AppExtensions/Extensions.plist" % username)
return extensions_list
def print_results(extensions_list):
tree = ET.parse(extensions_list)
root = tree.getroot()
list = ""
for key in root.iter('key'):
match = re.search('com.',key.text)
if match:
result = key.text
list = list + result + "\n"
return list.strip()
def main():
username = get_current_user()
extensions_list = get_extensions(username)
#results = parse_results(manifest_list)
to_echo = print_results(extensions_list)
print("<result>%s</result>" % to_echo)
if __name__ == '__main__':
main()
a week ago
This requires python in all system
3 weeks ago
I use this script, the only rub is it may still list an extension in the plist after you've already removed it.
#!/bin/bash
user=$(stat -f%Su /dev/console)
extensions_list="/Users/$user/Library/Containers/com.apple.Safari/Data/Library/Safari/WebExtensions/Extensions.plist"
ExtensionCheck=$( /bin/cat $extensions_list | /usr/bin/grep key | /usr/bin/grep extension)
echo "<result>$ExtensionCheck</result>"
exit 0
3 weeks ago
This scripts returns empty value when I run from Jamf EA.
when I run locally it return cat: /Users/sivakum/Library/Containers/com.apple.Safari/Data/Library/Safari/WebExtensions/Extensions.plist: Operation not permitted
3 weeks ago
I recently had need to deploy this: https://community.jamf.com/t5/jamf-pro/can-support-ea-for-this-script/m-p/321992/highlight/true#M277...
Should be easy to tailor for only Safari.
a week ago
tried this but for Safari it not gives enough details