Anyone working with Nessus, here is a Nessus un-install script.
Realized that as of Nessus version 10.2, Nessus is no longer called NessusAgent, just Nessus and the path location is: /Library/Nessus.
Also, as is common with these security agents installer,s the PKG is lacking, and woefully in most cases, and a re-package in Composer is necessary...
You have to grab the hidden file inside the DMG and drag into Composer and Convert to Source. I also removed the Preferences Pane, so a user cannot Stop/Start the agent.
I have a before script that looks for /Library/NessusAgent and delete it if present as well as unload with launchctl. So, the installer is always re-installing onto a clean slate...
#!/bin/sh
# if /Library/Nessus directorty exists, stop Nessus agent and delete all of Nessus, if not ignore.
if [ -d "/Library/Nessus" ]
then
echo "Directory /Library/Nessus exists. Stopping Nessus and Removing it."
/bin/launchctl stop com.tenablesecurity.nessus*
sleep 1
/bin/launchctl unload -w /Library/LaunchDaemons/com.tenablesecurity.nessus*.plist
sleep 1
rm -rf /Library/Nessus
rm /Library/LaunchDaemons/com.tenablesecurity.nessus*.plist
rm -r /Library/PreferencePanes/Nessus\\ Preferences.prefPane
echo "Nessus Agent has been removed..."
else
echo "Directory does not exist, nothing to do."
fi
exit 0
