Interface IScan

All Known Implementing Classes:
BaseScan, HostDiscovery, ServiceDiscovery

public interface IScan
Parent interface of all Scan implentations. Allows you to customize the scan behavior if for any reason the BaseScan doesn't meet your needs.
  • Method Details

    • setTiming

      void setTiming(IScan.TimingFlag tf)
      Sets the scan timing flag.
      Parameters:
      tf -
    • addPort

      void addPort(int port)
      Adds a single port to the scan spec; adds the implied -p flag. You can call this method repetitively to add ports.
      Parameters:
      port -
    • addPorts

      void addPorts(int[] ports)
      Allows you to add ports in a block; this can also be called repetitively.
      Parameters:
      ports -
    • includeHost

      void includeHost(String host)
      Add a single host to the list of hosts. Additive.
      Parameters:
      host -
    • includeHosts

      void includeHosts(String[] hosts)
      Add the the hosts from the array. Additive.
      Parameters:
      hosts -
    • excludeHost

      void excludeHost(String host)
      Add a single host to the list of excluded hosts. Additive.
      Parameters:
      host -
    • excludeHosts

      void excludeHosts(String[] hosts)
      Add the array of hosts to the list of hosts that are excluded. Additive.
      Parameters:
      hosts -
    • removeIncludeHost

      void removeIncludeHost(String host)
      Removes the specified host from the list of included hosts.
      Parameters:
      host -
    • removeIncludeHosts

      void removeIncludeHosts(String[] hosts)
      Removes all the hosts in the array from the list of included hosts. Should not throw any exceptions if a host in the array is not in the current list.
      Parameters:
      hosts -
    • removeExcludeHost

      void removeExcludeHost(String host)
      Remove one host from the list of excluded hosts.
      Parameters:
      host -
    • removeExcludeHosts

      void removeExcludeHosts(String[] hosts)
      Remove the list of hosts from the list of hosts that should be excluded from a scan.
      Parameters:
      hosts -
    • setOutputType

      void setOutputType(IScan.OutputType ot, String fileName)
      Sets the output type flag accordingly and also sets the filename. This method should be used to override the default behavior, writing XML to the std out.
      Parameters:
      ot -
    • executeScan

      Executes a scan and blocks while scan runs. If your scan is long running consider using the executeAsynchronousExecute() method.
      Returns:
      Throws:
      NMapInitializationException
      ParameterValidationFailureException
      NMapExecutionException
    • executeAsynchronousScan

      Execute a scan asynchronously; you must pass in a callback in order for this to work.
      Parameters:
      isc -
      Throws:
      ParameterValidationFailureException
      NMapExecutionException
    • setScanValidator

      void setScanValidator(IScanValidator isv)
      Allows for a controlled way to vet a scan configuration. Allows API users to verify the right combination of flags, the right values for things like ports or hosts (for example, allows users to prevent hosts from being scanned, etc).
      Parameters:
      isv -
      Throws:
      ParameterValidationFailureException
    • setNMapPath

      void setNMapPath(String path)
      Specifies the path in which to look for the nmap binaries and share directory. If this is not set, the API will try to use the environmental variable NMAP_HOME.
      Parameters:
      path -
    • addFlag

      void addFlag(Flag flag)
      Adds the specified flag to the underlying ArgumentProperties object.
    • removeFlag

      void removeFlag(Flag flag)
      Removes the specified flag from the underlying ArgumentProperties object.
    • getArgumentProperties

      ArgumentProperties getArgumentProperties()
      This provides access to the member variable for the ArgumentProperties.
      Returns:
    • getNMapProperties

      NMapProperties getNMapProperties()
      This provides access to the member variable for the NMapProperties.
      Returns: