Package tenapull.run

Class ScanJob

java.lang.Object
All Implemented Interfaces:
java.lang.Comparable<DbManagerJob.Child>

public class ScanJob
extends DbManagerJob.Child
Fetches the details of the scan provided in the constructor, and adds it to the Database. Generates a HostVulnsJob for each host listed in the Nessus API ScanResponse, that is added to the "nextJobs" list of the dbManager, to be run after all the ScanJobs are finished.
  • Constructor Details

    • ScanJob

      public ScanJob​(Scan scan) throws java.lang.NullPointerException
      Instantiates a new Scan job for the provided scan
      Parameters:
      scan - the scan
      Throws:
      java.lang.NullPointerException - if the provided scan is null
  • Method Details

    • isReady

      protected boolean isReady()
      Description copied from class: Job
      Is ready boolean. Indicates whether the job is ready to run yet. If false is returned, the job will be placed in the JobFactory's waitingJobs queue, with either the default wait time, or another wait time if a new one is set before returning false from isReady. The job will remain in the IDLE stage until isReady returns true, or the job is marked as failed. Failed jobs are not marked as DONE until after the method has returned
      Specified by:
      isReady in class Job
      Returns:
      the boolean
    • fetch

      protected void fetch​(NessusClient client) throws com.fasterxml.jackson.core.JsonProcessingException
      Description copied from class: Job
      Fetch any API resources, using the NessusClient provided by the worker thread. The job will remain in the FETCH stage until fetch returns without an exception, or the job is marked as failed. Failed jobs are not marked as DONE until after the method has returned
      Specified by:
      fetch in class Job
      Parameters:
      client - the nessus client provided by the worker thread which is running this job
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • process

      protected void process()
      Description copied from class: Job
      Perform any processing of the fetched data The job will remain in the PROCESS stage until fetch returns without an exception, or the job is marked as failed. Failed jobs are not marked as DONE until after the method has returned
      Specified by:
      process in class Job
    • output

      protected void output()
      Description copied from class: Job
      Perform any outputting of the processed data The job will remain in the OUTPUT stage until fetch returns without an exception, or the job is marked as failed. Failed jobs are not marked as DONE until after the method has returned
      Specified by:
      output in class Job
    • exceptionHandler

      protected boolean exceptionHandler​(java.lang.Exception e, Job.Stage stage)
      Description copied from class: Job
      Handles any exceptions thrown by isReady, fetch, process, and output methods. Return true if the operation should be attempted again immediately. Mark as failed to permanently end the job. Otherwise, the job will be placed in the delayedJobs queue, and put back into readyJobs once its wait time is up
      Specified by:
      exceptionHandler in class Job
      Parameters:
      e - the e
      stage - the stage
      Returns:
      the boolean
    • dbExceptionHandler

      protected boolean dbExceptionHandler​(java.lang.Exception e)
      Description copied from class: DbManagerJob.Child
      This method is invoked if the dbTask throws an exception. Since the child job will likely have returned and be marked as done by the time the task is actually run, it is necessary to include this in addition to the run-time exceptionHandler method of the Job superclass. This method is specific to exceptions thrown during the dbTask
      Specified by:
      dbExceptionHandler in class DbManagerJob.Child
      Parameters:
      e - the e
      Returns:
      the boolean
    • compareTo

      public int compareTo​(DbManagerJob.Child o)