Skip to content

Instantly share code, notes, and snippets.

@kevinkassimo
Last active January 2, 2018 18:57
Show Gist options
  • Save kevinkassimo/30fe69969331cafad0fb1ac53795a43b to your computer and use it in GitHub Desktop.
Save kevinkassimo/30fe69969331cafad0fb1ac53795a43b to your computer and use it in GitHub Desktop.
Get rid of warning
#!/bin/bash
# part of the script is introduced with inspiration from https://gist.github.com/tylergets/e4ab5bea35ddcd6c3134503b44284165
echo "Temporarily starting SafeConnect process..."
sudo launchctl enable system/scManagerD 2>&1 > /dev/null
sudo launchctl load /Library/LaunchDaemons/Safe.Connect.plist 2>&1 > /dev/null
sudo launchctl enable system/scClient 2>&1 > /dev/null
sudo launchctl load /Library/LaunchAgents/Safe.Connect.client.plist 2>&1 > /dev/null
cd /Applications/SafeConnect.app/Contents/MacOS/
open -a "/Applications/SafeConnect.app/Contents/MacOS/scClient"
open -a "/Applications/SafeConnect.app/Contents/MacOS/scManagerD"
# sudo /Applications/SafeConnect.app/Contents/MacOS/scManagerD 2>&1 > /dev/null &
# sudo /Applications/SafeConnect.app/Contents/MacOS/scClient 2>&1 > /dev/null &
sleep 5
echo "Simulating a minor HTTP request..."
# even better, pretend I am Linux for a while
curl -s -I --user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Ubuntu/11.10 Chromium/27.0.1453.93 Chrome/27.0.1453.93 Safari/537.36" www.baidu.com 2>&1 > /dev/null
sleep 5
echo "Removing SafeConnect launchd service..."
sudo launchctl disable system/scManagerD 2>&1 > /dev/null
sudo launchctl unload /Library/LaunchDaemons/Safe.Connect.plist 2>&1 > /dev/null
sudo launchctl disable system/scClient 2>&1 > /dev/null
sudo launchctl unload /Library/LaunchAgents/Safe.Connect.client.plist 2>&1 > /dev/null
echo "Terminating SafeConnect processes..."
osascript -e 'tell application "SafeConnect.app" to quit'
# sudo ps -ef | grep "[s]cManagerD" | while read -r a; do
# echo $a | awk '{print $2}' | xargs kill -9 2>&1 > /dev/null
# done
# sudo ps -ef | grep "[s]cClient" | while read -r a; do
# echo $a | awk '{print $2}' | xargs kill -9 2>&1 > /dev/null
# done
# sudo ps -ef | grep [s]cManagerD | awk '{print $2}' | xargs kill 2>&1 > /dev/null
# sudo ps -ef | grep [s]cClient | awk '{print $2}' | xargs kill 2>&1 > /dev/null
echo "Done!"
# Also, it turned out to be very useful to change the user agent of the browser to something else: SafeConnect would usually ignore Linux machines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment