Package tenapull.run
Class HostVulnsJob
java.lang.Object
tenapull.run.Job
tenapull.run.DbManagerJob.Child
tenapull.run.HostVulnsJob
- All Implemented Interfaces:
java.lang.Comparable<DbManagerJob.Child>
public class HostVulnsJob extends DbManagerJob.Child
Takes a given scanResponse and host from the scanResponse, and fetches the host vulnerability
data from the Nessus API about that host. The resulting data is output as a .json file ready
for Splunk ingestion, and the DB is updated to show that this is the most recent file generated
for this host_id/scan_id combination
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringOUTPUT_DIRThe output directory, as obtained by Main from the config file specified in command-line arg[0] -
Constructor Summary
Constructors Constructor Description HostVulnsJob(ScanResponse scanResponse, ScanHost host)Instantiates a new Host vulns job using the provided scanResponse and scan host. -
Method Summary
Modifier and Type Method Description intcompareTo(DbManagerJob.Child o)protected booleandbExceptionHandler(java.lang.Exception e)This method is invoked if the dbTask throws an exception.protected booleanexceptionHandler(java.lang.Exception e, Job.Stage stage)Handles any exceptions thrown by isReady, fetch, process, and output methods.protected voidfetch(NessusClient client)Fetch any API resources, using the NessusClient provided by the worker thread.protected booleanisReady()Is ready boolean.protected voidoutput()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.protected voidprocess()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.Methods inherited from class tenapull.run.DbManagerJob.Child
addAfterDone, addCurrentChildJob, addDbTask, addToNextDbJobs, notifyChildOfExit, notifyOfExitMethods inherited from class tenapull.run.Job
addJob, addJobs, equals, failed, getAccessor, getStage, start, tryAgainIn, waitForExit
-
Field Details
-
OUTPUT_DIR
public static final java.lang.String OUTPUT_DIRThe output directory, as obtained by Main from the config file specified in command-line arg[0]
-
-
Constructor Details
-
HostVulnsJob
Instantiates a new Host vulns job using the provided scanResponse and scan host.- Parameters:
scanResponse- the scan response which the host originates fromhost- the host to obtain the vulnerability data about
-
-
Method Details
-
isReady
protected boolean isReady()Description copied from class:JobIs 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 -
fetch
protected void fetch(NessusClient client) throws com.fasterxml.jackson.core.JsonProcessingExceptionDescription copied from class:JobFetch 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 -
process
protected void process()Description copied from class:JobPerform 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 -
output
protected void output() throws java.io.FileNotFoundException, java.io.IOExceptionDescription copied from class:JobPerform 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 -
exceptionHandler
Description copied from class:JobHandles 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:
exceptionHandlerin classJob- Parameters:
e- the estage- the stage- Returns:
- the boolean
-
dbExceptionHandler
protected boolean dbExceptionHandler(java.lang.Exception e)Description copied from class:DbManagerJob.ChildThis 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:
dbExceptionHandlerin classDbManagerJob.Child- Parameters:
e- the e- Returns:
- the boolean
-
compareTo
-