Package tenapull.run

Class Main

java.lang.Object
tenapull.run.Main

public class Main
extends java.lang.Object
The entry point to the TenaPull application. Processes the config file provided in command line arg, and then enters the jobs loop if the config is valid. If config is invalid, this will return a descriptive error message and then exit.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String TESTS_CONFIG
    The configuration file to use for Unit tests, since they do NOT enter the application through the public static void main(String[] args) method of Main.
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String buildUrl​(java.util.Properties config, java.lang.String prefix)
    Used to build a url string from the provided config and prefix.
    static boolean confirmJob​(java.lang.String msg)  
    static java.util.Properties getConfig()
    Gets a copy of the application config, as parsed from the filename provided in the command line arg[0]
    static java.lang.String getConfig​(java.lang.String property)  
    static boolean getErrorStatus()
    Gets whether the error status flag has been marked.
    static java.lang.Class<? extends Job> getMainJobType()  
    static java.lang.Integer getTruncate()  
    static boolean initOutputDir()  
    static boolean isMain()
    Returns whether the current thread is the main thread or not
    static boolean isMain​(java.lang.Thread thread)
    Returns whether the provided thread is the main thread or not
    static boolean loadTestConfig()
    Loads the default config for unit tests, since they do not enter the application through the usual public static main(String[] args) of this class
    static void main​(java.lang.String[] args)
    The entry point of the application.
    static void markErrorStatus()
    Marks the application as having an error, so that it will exit with status code -1

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TESTS_CONFIG

      public static final java.lang.String TESTS_CONFIG
      The configuration file to use for Unit tests, since they do NOT enter the application through the public static void main(String[] args) method of Main.
      See Also:
      Constant Field Values
  • Method Details

    • main

      public static void main​(java.lang.String[] args) throws java.io.IOException
      The entry point of the application. There should be at least one arg which indicates the configuration file to use for this run of TenaPull. The config file itself should have a .properties extension, but the extension may be left out of the command line argument (e.g. myscanner1.properties could be myscanner1) There may be an optional second argument specifying to perform a database reset instead of the normal Nessus API tasks. This argument may be "reset", "dbReset", or "resetDb." The database reset will first prompt for a confirmation before performing the reset.
      Parameters:
      args - the input arguments
      Throws:
      java.io.IOException
    • isMain

      public static boolean isMain()
      Returns whether the current thread is the main thread or not
      Returns:
      true if the invoking thread is the main thread, false is not.
    • isMain

      public static boolean isMain​(java.lang.Thread thread)
      Returns whether the provided thread is the main thread or not
      Returns:
      true if the provided thread is the main thread, false is not.
    • markErrorStatus

      public static void markErrorStatus()
      Marks the application as having an error, so that it will exit with status code -1
    • getErrorStatus

      public static boolean getErrorStatus()
      Gets whether the error status flag has been marked.
      Returns:
      true if the error status flag has been marked, false if not
    • getConfig

      public static java.util.Properties getConfig()
      Gets a copy of the application config, as parsed from the filename provided in the command line arg[0]
      Returns:
      a copy of the config
    • getConfig

      public static java.lang.String getConfig​(java.lang.String property)
    • loadTestConfig

      public static boolean loadTestConfig() throws java.lang.IllegalStateException
      Loads the default config for unit tests, since they do not enter the application through the usual public static main(String[] args) of this class
      Returns:
      true if the configuration was valid, false if not
      Throws:
      java.lang.IllegalStateException - if another config was already loaded
    • buildUrl

      public static java.lang.String buildUrl​(java.util.Properties config, java.lang.String prefix)
      Used to build a url string from the provided config and prefix. Used by both "db" prefix and "api" prefix.
      Parameters:
      config - the config to parse for a url
      prefix - the prefix to obtain the url components from (typically either "db" or "api")
      Returns:
      the string
    • getMainJobType

      public static java.lang.Class<? extends Job> getMainJobType()
    • initOutputDir

      public static boolean initOutputDir()
    • getTruncate

      public static java.lang.Integer getTruncate()
    • confirmJob

      public static boolean confirmJob​(java.lang.String msg)