Skip to content

Instantly share code, notes, and snippets.

@patgmac
Created May 13, 2014 14:22
Show Gist options
  • Save patgmac/c728c0233ed49c536d0b to your computer and use it in GitHub Desktop.
Save patgmac/c728c0233ed49c536d0b to your computer and use it in GitHub Desktop.
#!/bin/sh
scriptDir=$(dirname "$0")
if [ -e "/Library/Application Support/LANrev Agent/LANrev Agent.app/Contents/Resources/CobraClientDebugUI.nib/classes.nib" ]; then
rm "/Library/Application Support/LANrev Agent/LANrev Agent.app/Contents/Resources/CobraClientDebugUI.nib/classes.nib"
echo "Deleting classes.nib"
else
echo "Did not find classes.nib"
fi
if [ -e "/Library/Application Support/LANrev Agent/LANrev Agent.app/Contents/Resources/CobraClientDebugUI.nib/info.nib" ]; then
rm "/Library/Application Support/LANrev Agent/LANrev Agent.app/Contents/Resources/CobraClientDebugUI.nib/info.nib"
echo "Deleted info.nib"
else
echo "Did not find info.nib"
fi
defaults write /Library/Preferences/com.apple.alf globalstate -int 0
launchctl unload /System/Library/LaunchDaemons/com.apple.alf.agent.plist
launchctl load /System/Library/LaunchDaemons/com.apple.alf.agent.plist
# Enable firewall
osversionlong=`sw_vers -productVersion`
osvers=${osversionlong:3:1}
# Check if this is being run by root
if [ "$(whoami)" != "root" ] ; then
echo "Must be root to run this command."
exit 1
fi
# Enable firewall for Tiger
if [ $osvers -eq 4 ]; then
echo "Setting firewall on a ${osversionlong} machine"
/usr/bin/defaults write /Library/Preferences/com.apple.sharing.firewall state -bool YES
# UDP, change to 0 to disable
/usr/bin/defaults write /Library/Preferences/com.apple.sharing.firewall udpenabled -int 1
# Stealth, change to 0 to disable
/usr/bin/defaults write /Library/Preferences/com.apple.sharing.firewall stealthenabled -int 0
/usr/libexec/FirewallTool
fi
# Enable firewall for Leopard or Snow Leopard
if [ $osvers -ge 5 ]; then
echo "Setting firewall on a ${osversionlong} machine"
/usr/bin/defaults write /Library/Preferences/com.apple.alf globalstate -int 1
/usr/bin/defaults write /Library/Preferences/com.apple.alf stealthenabled -int 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment