Posted on 08-08-2022 05:42 AM
Hello Jamf Nation,
For security reasons at my org, we are trying to compile a list of installed extension for the Chrome, Firefox and Safari browsers.
I've seen a couple posts about chrome extensions and have a script for just Chrome. Does anyone know of a good script that can pull extensions from all three?
Posted on 08-08-2022 06:15 AM
I've been working on something similar -- extensions/add-ons are an underrated thing to be checking! I don't have a comprehensive script for all three, but I have an EA for Firefox extensions based on this one for Chrome. Safari is next.
08-08-2022 06:44 AM - edited 08-08-2022 07:01 AM
Hey @dmortensen,
These are awesome! Thank you so much. Going to test these out. Looking forward to the Safari one!
Posted on 08-08-2022 07:22 AM
Hey @dmortensen,
Can you inform me of how you have these setup in your JAMF instance? Currently can't get these two to run correctly and not sure if I'm doing something wrong or not. Set them up in EA's and i'm trying to generate a downloadable csv report but doesn't seem to be working.
Posted on 08-08-2022 07:27 AM
Sure! I've structured these and run them as Extension Attributes, so assuming you use them the same way, you could create an Advanced Search (looking for All Managed Devices, for example) that displays those fields, then download the CSV report.
Here's my modified Chrome EA for python3 in case that's helpful.
Posted on 08-08-2022 07:44 AM
Gotcha! I've set them both up as Extension Attributes, and have created an Advanced Search that displays those fields. Once downloaded though, the fields are empty? Do i have to wait for inventory to run on all machines for this to generate results or?
Posted on 08-08-2022 08:23 AM
Yep! Inventory needs to run on the machines. Also, if you're using what I linked, note that those two EAs use managed_python3, so if you have a different version of python3 or no python3 at all, they won't run.
Posted on 08-08-2022 08:29 AM
Ah gotcha. That's probably the issue then. I believe the majority of the machines (if not all) that we have do not have Python3. In this case, I guess we'd need to use xml I assume
Posted on 08-08-2022 08:42 AM
The Firefox file that stores the add-ons list is .json and if I remember correctly, the Chrome extensions list is as well. That's not to say that you couldn't parse the json with bash or zsh but it was tedious enough that I decided to stretch into python for it. If you can get it approved and out to your macs, managed python3 provides a lot of utility. https://github.com/macadmins/python
Posted on 08-08-2022 09:15 AM
Actually I believe I misspoke.
Looks as if Python3 is on our machines by default. So still not sure why the EA's aren't working :(
Posted on 08-08-2022 09:27 AM
Ah I think its just the standard python3 that comes with the machine. Don't believe it's the managed_python3 you are referring to.
Posted on 08-08-2022 09:39 AM
I assume you switched the first line to include a path to your python3? If not, do that, but if so, have you tried running the script locally on a test machine/vm? That might give some insight into what's going on.
08-08-2022 10:04 AM - edited 08-08-2022 10:06 AM
Yep! I changed it to /usr/bin/python3.
Current result from running via a Self Service Policy:
[STEP 1 of 4]
Executing Policy Extensions Test
[STEP 2 of 4]
Running script Chrome Extensions List...
Script exit code: 1
Script result: File "/Library/Application Support/JAMF/tmp/Chrome Extensions List", line 90
print result
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(result)?
Error running script: return code was 1.
[STEP 3 of 4]
[STEP 4 of 4]
Just to note, I ran this locally on just my machine to test. But definitely want to have it setup as an EA so I can quickly grab a report of everyone's extensions and whatnot
Posted on 08-08-2022 10:16 AM
For the local run of the firefox one, I get the following:
[STEP 1 of 4]
Executing Policy Extensions Test
[STEP 2 of 4]
Running script Get Firefox Extensions...
Script exit code: 1
Script result: Traceback (most recent call last):
File "/Library/Application Support/JAMF/tmp/Get Firefox Extensions", line 17, in <module>
from SystemConfiguration import SCDynamicStoreCopyConsoleUser
ModuleNotFoundError: No module named 'SystemConfiguration'
Error running script: return code was 1.
[STEP 3 of 4]
[STEP 4 of 4]
Posted on 08-08-2022 01:02 PM
Chrome is not a huge need now.
Really am trying to focus on getting Firefox and Safari EA's working to report extensions
Posted on 08-09-2022 12:19 PM
Looking over those errors, it's likely that the dependencies/modules for those pieces are missing from the python environment. That's one reason I do really like that admin-friendly distribution of python and I really recommend it. If you wanted to adapt those scripts, you could get find other modules to use in their place.
Posted on 05-11-2023 02:20 PM
Any chance with Safari? I got stuck there too
Posted on 05-12-2023 06:29 AM
Posted on 12-07-2022 09:48 AM
So i attempted to make the chrome EA, copied and pasted the code, changed it to the /usr/bin/python3
but it just doesn't run.
if i run it manually i get this error
ModuleNotFoundError: No module named 'SystemConfiguration'
i installed python from here as a test as well
any help is appreciated
https://github.com/macadmins/python/releases/tag/v3.10.2.80694