Posted on 01-30-2014 07:40 AM
I am trying to create an extension attribute that will report weather the proxy plugin "hola" has been installed on google chrome. The hola plugin installs files into the current logged in user's profile so I thought maybe some scripting that looked for one of the files existing or not would be a way to detect which students installed this plugin. I found another post here on JAMF nation that had some "if file exhist" work in it but I can't seem to adapt it for my needs. Here is my current script. Any thought on where I went wrong or a better approach? Thanks in advance and keep in mind I have VERY simple scripting skills.
Data type = string
Input type = script
Script:
#!/usr/bin/env ruby
result = File.exist?("result = File.exist?("/Users/'3$'/Library/ApplicationSupport/Google/Chrome/Default/Extensions/gkojfkhlekighikafcpjkiklfbnlmeio/1.2.449_0/js/cs_hola.js ") ? "yes" : "no"
puts "<result>#{result}</result>"
Solved! Go to Solution.
Posted on 01-30-2014 08:07 AM
Try this (run it locally on test systems first, of course):
#!/bin/bash
currentUser=`ls -l /dev/console | awk '{print $3}'`
if [ -f "/Users/$currentUser/Library/ApplicationSupport/Google/Chrome/Default/Extensions/gkojfkhlekighikafcpjkiklfbnlmeio/1.2.449_0/js/cs_hola.js" ]; then
echo "<result>Yes</result>"
else
echo "<result>No</result>"
fi
Posted on 01-30-2014 08:07 AM
Try this (run it locally on test systems first, of course):
#!/bin/bash
currentUser=`ls -l /dev/console | awk '{print $3}'`
if [ -f "/Users/$currentUser/Library/ApplicationSupport/Google/Chrome/Default/Extensions/gkojfkhlekighikafcpjkiklfbnlmeio/1.2.449_0/js/cs_hola.js" ]; then
echo "<result>Yes</result>"
else
echo "<result>No</result>"
fi
Posted on 01-30-2014 09:23 AM
Success! or Qapla! for our Klingon speaking JAMF members,
I made a mistake in the file path I published above. I used a indicating a space between "Application" and "Support". The entire path is in quotes. As soon as I got rid of the things worked nicely. Thanks for the help. "If file Exist" detection will be very useful for other future needs we will likely have. I'm sure we will be recycling this script.
Thanks again or "Qatlho" (like a Klingon would say thank you...)
Sincerely,
Paul
Posted on 02-06-2014 10:04 AM
Rather than search for a single file whose path will change every time an update to the Hola extension is updated, you can search for the folder that contains this. This path will not change.
#!/bin/bash
currentUser=`ls -l /dev/console | awk '{print $3}'`
if [ -d "/Users/$currentUser/Library/Application Support/Google/Chrome/Default/Extensions/gkojfkhlekighikafcpjkiklfbnlmeio" ]; then
echo "<result>Yes</result>"
else
echo "<result>No</result>"
fi
Posted on 02-06-2014 12:43 PM
I was able to cobble together a script for Firefox as well. Because, upon first launch, Firefox creates a profile folder with a randomly-generated name, it's hard to code for a specific path like you can with Google Chrome. But you can have your script search for a folder that's part of the Hola installation in the "Profiles" folder and then output a value based on the results:
#!/bin/bash
currentUser=`ls -l /dev/console | awk '{print $3}'`
holaFirefox=`find /Users/${currentUser}/Library/Application Support/Firefox/Profiles -iname "hola_firefox_ext" -type d`
if [ -z "${holaFirefox}" ]; then
echo "<result>No</result>"
else
echo "<result>Yes</result>"
fi
And now I can create a smart group to see who has Hola installed for Chrome and Firefox. And then I can easily create a policy that runs a script to delete the Hola VPN/proxy.
Yes, an end-user could re-install it, but the next time their machine Reconned, they'd be put back into the smart group and have the policy executed to delete it again. Not perfect, but pretty good.
I may play around with deleting a specific important file that's part of the Hola installation. This would make it look the end-user like Hola is installed but would break its functionality. Adds another layer of obfuscation they'd have to troubleshoot through to get it running.
Posted on 10-22-2015 02:50 AM
Did you ever do anymore work on this? I am think of adding this to my implementation of SavingThrow