Does anyone have an example of how I could disable and enable all scheduled scans for all sites through the api? I am failing to really find any good examples for being able to work with existing scheduled scans. Thanks
Here is a Ruby script that allows you to enable, disable, or delete scan schedules on all sites or specified site IDs: A script to enable/disable/delete site schedules in bulk · GitHub
When specifying site IDs, separate them with commas (without spaces). For example:
bulk_modify_schedules.rb enable 1,2,3 -d
Use the -h (or --help) flag to see all of the options. The -d option will set dry run, which will allow you to preview changes without actually modifying your schedules yet.
This script will probably end up in the nexpose-client repo after I clean it up a bit more.
Thank you Gavin! Was not expecting a full script, this is perfect. Appreciate the effort.
I happened to have this script around for a while and your post prompted me to update it to work with newer versions of the gem, so that was a bit of luck.
Maybe just me but just did a full test to disable all and while it did disable, it also deleted the name of every scheduled scan. Poking around with it now to see if I can spot why that happened for me.
This is likely due to the Ruby gem not supporting the schedule names, so they do not get parsed and end up being "removed" when saving changes to the site. Good catch - we should add that to the gem. Add schedule name support · Issue #272 · rapid7/nexpose-client · GitHub
Great thank you for opening up the bug report as well.
Retrieving data ...