Posted on 01-31-2022 02:07 PM
So we have a nice tool to looks at packages for scripts that might have deprecated languages in them (see https://github.com/scriptingosx/pkgcheck). Has anyone created something to look at the first line of all the scripts in the JSS and report ? I am guessing would have to use the JAMF API, to get <script_contents>, then match on the first line like in pkgcheck. Anyone working on this?
Solved! Go to Solution.
01-31-2022 11:32 PM - edited 02-01-2022 04:01 AM
found this yesterday: https://github.com/laurentpertois/Search-Scripts-In-Jamf
I haven't tested it yet but you can try it 😅
Posted on 02-01-2022 06:50 AM
@Nick1403 Great find! works well! I did searches on 1828 scripts and 173 extension attributes for "/usr/bin/python",
"/usr/bin/perl" and "/usr/bin/ruby". I created a Jamf account that could only read Scripts and Computer Extension Attributes. One thing to note is that I also found serval scripts that were calling python without the full path (tsk). Kudos to Lauren for the script!!
Posted on 01-31-2022 03:21 PM
If you have access to your database you can do this pretty easily with a select statement.
select script_id,file_name from scripts where script_contents like '%python%';
Posted on 01-31-2022 03:22 PM
We are cloud hosted so this won't work for us but good tip for on prem. folks
01-31-2022 06:25 PM - edited 01-31-2022 06:28 PM
@ega It's a little brute force, but my approach for checking python use was to run https://github.com/jamf/JamfMigrator in Save Only mode to make a local copy of all of the Script objects in my JSS, and then searching the directory of exported scripts for 'python'.
01-31-2022 03:54 PM - edited 02-01-2022 07:00 AM
Here is what I used to search, it searches both scripts and EA, https://github.com/laurentpertois/Search-Scripts-In-Jamf
01-31-2022 11:32 PM - edited 02-01-2022 04:01 AM
found this yesterday: https://github.com/laurentpertois/Search-Scripts-In-Jamf
I haven't tested it yet but you can try it 😅
Posted on 02-01-2022 07:02 AM
I've tested it and it does work. I used https://github.com/laurentpertois/Search-Scripts-In-Jamf/blob/main/searchScriptsAndEAsInJamf.sh to also find any python reference in EAs.
Posted on 02-01-2022 06:50 AM
@Nick1403 Great find! works well! I did searches on 1828 scripts and 173 extension attributes for "/usr/bin/python",
"/usr/bin/perl" and "/usr/bin/ruby". I created a Jamf account that could only read Scripts and Computer Extension Attributes. One thing to note is that I also found serval scripts that were calling python without the full path (tsk). Kudos to Lauren for the script!!
03-22-2022 05:31 AM - edited 03-22-2022 05:32 AM
Nice little script, worked for me flawlessly.
Question tho, is it enough to just disable the Policies/EAs that use Python to get rid of the jamfdeamon alerts? Or do the Scripts/EA's need to be deleted from the JSS alltogether?