Skip to content

Instantly share code, notes, and snippets.

@healeyio
Created May 13, 2019 19:27
Show Gist options
  • Save healeyio/4e0d056ab9ce0b4d8aad519a5078d2e2 to your computer and use it in GitHub Desktop.
Save healeyio/4e0d056ab9ce0b4d8aad519a5078d2e2 to your computer and use it in GitHub Desktop.
OpenVAS Update Script
#!/bin/bash
# Only update OpenVAS when no scans are running
scanRunning="$(ps aux | grep "openvassd: testing " | wc -l)"
scanRunning=$((scanRunning + "$(ps aux | grep "openvasmd: OTP: Handling scan" | wc -l)"))
# if the commands above result in 2 or less, a scan is not running and it is safe to update
if [ $scanRunning -le 2 ]; then
echo "Updating OpenVas Feeds"
/usr/sbin/greenbone-nvt-sync
/usr/sbin/greenbone-certdata-sync
/usr/sbin/greenbone-scapdata-sync
/usr/sbin/openvasmd --update --verbose --progress
/bin/systemctl restart openvas-scanner
/bin/systemctl restart openvas-manager
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment