Obtain list of installed extensions (Chrome, Firefox, Safari)

mlooney
Contributor

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? 

16 REPLIES 16

dmortensen
New Contributor II

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.

Hey @dmortensen,

 

These are awesome! Thank you so much. Going to test these out. Looking forward to the Safari one!

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.

dmortensen
New Contributor II

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.

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? 

dmortensen
New Contributor II

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.

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

dmortensen
New Contributor II

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

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 :( 

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.

dmortensen
New Contributor II

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. 

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

 

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]

Chrome is not a huge need now.

 

Really am trying to focus on getting Firefox and Safari EA's working to report extensions 

dmortensen
New Contributor II

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.

szultzie
Contributor II

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