Inprotect nessus_scan.pl fix

I have been working with version v0.80.1 Beta of Inprotect, a web and reporting front end for Nessus. It's been quite a while since the project has been updated but overall it still works fairly well out of the box. One small issue I found was completed scans that were getting stuck in the a Running state and never being removed from the nessus_scan table.

The bug is in the /usr/local/bin/nessus_scan.pl when it updates the nessus_scan table around line number 193 in my version of the script:

         # set a scan schedule to a running state
           my $sth_updnsr = $dbhf->prepare(qq{
           UPDATE nessus_scan
           SET status="R", start_dttm=now(), process_id=?
           WHERE server_id=?
           AND sched_id=?
           } );

This bit of code updates every scan row to a running state even if it has completed. So when all scans are done the clean up process can not happen. It's not a major bug but the schedule that ran is never marked complete and can not be executed again until all the running scans are cleaned up.

To fix this issue just modify the bit of code above and add another section to the where clause "ADD end_dttm IS NULL".

         # set a scan schedule to a running state
           my $sth_updnsr = $dbhf->prepare(qq{
           UPDATE nessus_scan
           SET status="R", start_dttm=now(), process_id=?
           WHERE server_id=?
           AND sched_id=?
           AND end_dttm IS NULL
           } );

Now the scans will be marked as completed and the system can clean everything up and mark the schedule finished.

Leave a Reply

jump2top free wordpress themes