Class ExtensionPassiveScan

    • Constructor Detail

      • ExtensionPassiveScan

        public ExtensionPassiveScan()
    • Method Detail

      • hook

        public void hook​(ExtensionHook extensionHook)
        Description copied from interface: Extension
        Called during extension's initialisation to allow to add new functionality to core components.
        Specified by:
        hook in interface Extension
        Overrides:
        hook in class ExtensionAdaptor
        Parameters:
        extensionHook - the hook to add the components.
      • optionsLoaded

        public void optionsLoaded()
        Description copied from interface: Extension
        Called after the options for this extension have been loaded, so that the extension can make use of them. Note that other add-ons may not have been loaded at this point - if you need them to be then implement postInit()
        Specified by:
        optionsLoaded in interface Extension
        Overrides:
        optionsLoaded in class ExtensionAdaptor
        See Also:
        Extension.postInit()
      • getActiveActions

        public java.util.List<java.lang.String> getActiveActions()
        Description copied from interface: Extension
        Returns the (internationalised) names of all active actions of the extension - if there are any the user will be given the option not to exit ZAP or, if the extension is bundled in an add-on that's being updated or uninstalled, not to continue with the changes.

        An active action is something that's started by the user, for example, a scan.

        Specified by:
        getActiveActions in interface Extension
        Overrides:
        getActiveActions in class ExtensionAdaptor
        Returns:
        a List containing the active actions or null if none
        See Also:
        Extension.getUnsavedResources()
      • removePassiveScanner

        public boolean removePassiveScanner​(java.lang.String className)
      • addPassiveScanner

        public boolean addPassiveScanner​(PassiveScanner passiveScanner)
        Adds the given passive scanner to the list of passive scanners that will be used to scan proxied messages.

        The passive scanner will not be added if there is already a passive scanner with the same name.

        If the passive scanner extends from PluginPassiveScanner it will be added with the method addPluginPassiveScanner(PluginPassiveScanner).

        Parameters:
        passiveScanner - the passive scanner that will be added
        Returns:
        true if the scanner was added, false otherwise.
        Throws:
        java.lang.IllegalArgumentException - if the given passive scanner is null.
        See Also:
        PluginPassiveScanner, addPluginPassiveScanner(PluginPassiveScanner), PassiveScanner
      • removePassiveScanner

        public boolean removePassiveScanner​(PassiveScanner passiveScanner)
        Removes the given passive scanner from the list of passive scanners that are used to scan proxied messages.

        The passive scanners are removed using their class name.

        Parameters:
        passiveScanner - the passive scanner that will be removed
        Returns:
        true if the scanner was removed, false otherwise.
        Throws:
        java.lang.IllegalArgumentException - if the given passive scanner is null.
        See Also:
        PassiveScanner
      • addPluginPassiveScanner

        public boolean addPluginPassiveScanner​(PluginPassiveScanner pluginPassiveScanner)
        Adds the given plug-in passive scanner to the list of passive scanners that will be used to scan proxied messages.

        The passive scanner will not be added if there is already a passive scanner with the same name.

        Parameters:
        pluginPassiveScanner - the plug-in passive scanner that will be added
        Returns:
        true if the plug-in scanner was added, false otherwise.
        Throws:
        java.lang.IllegalArgumentException - if the given plug-in passive scanner is null.
        See Also:
        PluginPassiveScanner
      • removePluginPassiveScanner

        public boolean removePluginPassiveScanner​(PluginPassiveScanner pluginPassiveScanner)
        Removes the given plug-in passive scanner from the list of passive scanners that are used to scan proxied messages.

        The plug-in passive scanners are removed using their class name.

        Parameters:
        pluginPassiveScanner - the passive scanner that will be removed
        Returns:
        true if the plug-in scanner was removed, false otherwise.
        Throws:
        java.lang.IllegalArgumentException - if the given plug-in passive scanner is null.
        See Also:
        PluginPassiveScanner
      • getPluginPassiveScanner

        public PluginPassiveScanner getPluginPassiveScanner​(int id)
        Gets the PluginPassiveScanner with the given ID.
        Parameters:
        id - the ID of the plugin.
        Returns:
        the PluginPassiveScanner, or null if not found (e.g. not installed).
        Since:
        2.7.0
      • setAllScannerThreshold

        public void setAllScannerThreshold​(Plugin.AlertThreshold at)
        Parameters:
        at -
      • getRecordsToScan

        public int getRecordsToScan()
      • clearQueue

        public void clearQueue()
        Empties the passive scan queue without passively scanning the messages. Currently running rules will run to completion but new rules will only be run when new messages are added to the queue.
        Since:
        2.12.0
      • sessionAboutToChange

        public void sessionAboutToChange​(Session session)
        Description copied from interface: SessionChangedListener
        Called just prior to the session changing. Listeners should close down any resources associated with this session. sessionAboutToChange may be called by non-event thread. Should handle with care in all the listener. Use EventThread for each GUI event.
        Specified by:
        sessionAboutToChange in interface SessionChangedListener
        Parameters:
        session - the session about to be closed
      • sessionChanged

        public void sessionChanged​(Session session)
        Description copied from interface: SessionChangedListener
        Called just after the session has changed. sessionChanged may be called by non-event thread. Should handle with care in all the listener. Use EventThread for each GUI event.
        Specified by:
        sessionChanged in interface SessionChangedListener
        Parameters:
        session - the new session
      • getCurrentRuleName

        @Deprecated
        public java.lang.String getCurrentRuleName()
        Deprecated.
        (2.12.0) use #getOldestRunningTask()
        Returns:
        the oldest rule name running
      • getCurrentUrl

        @Deprecated
        public java.lang.String getCurrentUrl()
        Deprecated.
        (2.12.0) use #getOldestRunningTask()
        Returns:
        the oldest URL being scanned
      • getCurrentRuleStartTime

        @Deprecated
        public long getCurrentRuleStartTime()
        Deprecated.
        (2.12.0) use #getOldestRunningTask()
        Returns:
        the start time of oldest rule running
      • getOldestRunningTask

        public PassiveScanTask getOldestRunningTask()
        Returns the oldest running task (if any).
        Returns:
        the oldest running task
        Since:
        2.12.0
      • getRunningTasks

        public java.util.List<PassiveScanTask> getRunningTasks()
      • destroy

        public void destroy()
        Description copied from interface: Extension
        Performs final cleanups, free resources.

        Called when the extension is removed (i.e. corresponding add-on is uninstalled) and when ZAP shuts down.

        Called after stopping the extension.

        Should be called only by core functionality.

        Specified by:
        destroy in interface Extension
        Overrides:
        destroy in class ExtensionAdaptor
      • getDependencies

        public java.util.List<java.lang.Class<? extends Extension>> getDependencies()
        Description copied from interface: Extension
        Gets the list of Extensions that this extension depends on.
        Specified by:
        getDependencies in interface Extension
        Overrides:
        getDependencies in class ExtensionAdaptor
        Returns:
        the list of dependencies, empty (or null) if none.
      • sessionScopeChanged

        public void sessionScopeChanged​(Session session)
        Description copied from interface: SessionChangedListener
        Called when the user has changes the session scope. sessionScopeChanged may be called by non-event thread. Should handle with care in all the listener. Use EventThread for each GUI event.
        Specified by:
        sessionScopeChanged in interface SessionChangedListener
        Parameters:
        session - the current session
      • getAuthor

        public java.lang.String getAuthor()
        Description copied from interface: Extension
        Gets the author of the extension.

        Since 2.9.0 defaults to the author of the add-on, if set, otherwise an empty string.

        Specified by:
        getAuthor in interface Extension
        Returns:
        the author of the extension, might be null.
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: Extension
        Returns the description of the extension, to be shown in UI components. The description must be internationalised.
        Specified by:
        getDescription in interface Extension
        Overrides:
        getDescription in class ExtensionAdaptor
        Returns:
        the description of the extension, never null
      • sessionModeChanged

        public void sessionModeChanged​(Control.Mode mode)
        Description copied from interface: SessionChangedListener
        Called when the user changes the mode. sessionModeChanged may be called by non-event thread. Should handle with care in all the listener. Use EventThread for each GUI event.
        Specified by:
        sessionModeChanged in interface SessionChangedListener
        Parameters:
        mode - the new mode
      • saveTo

        public void saveTo​(org.apache.commons.configuration.Configuration conf)
      • loadFrom

        public void loadFrom​(org.apache.commons.configuration.Configuration conf)
      • getScanStatus

        protected ScanStatus getScanStatus()
      • supportsLowMemory

        public boolean supportsLowMemory()
        Description copied from interface: Extension
        Return true it the extension can run with the 'low memory' option. If the low memory option is set (and the extension supports it) then code should minimize the data stored in memory, using the db for all significant data. Extensions that do not support the low memory option will not be run if the option is set.
        Specified by:
        supportsLowMemory in interface Extension
        Overrides:
        supportsLowMemory in class ExtensionAdaptor
        Returns:
        true if the extension support the 'low memory' option, false otherwise
      • supportsDb

        public boolean supportsDb​(java.lang.String type)
        No database tables used, so all supported
        Specified by:
        supportsDb in interface Extension
        Overrides:
        supportsDb in class ExtensionAdaptor
        Parameters:
        type - the db type
        Returns:
        true if the specified db type is supported by the extension (or if it doesn't use any db)
        See Also:
        Database.getType()