Class ExtensionPassiveScan
- java.lang.Object
-
- org.parosproxy.paros.extension.ExtensionAdaptor
-
- org.zaproxy.zap.extension.pscan.ExtensionPassiveScan
-
- All Implemented Interfaces:
Extension
,SessionChangedListener
public class ExtensionPassiveScan extends ExtensionAdaptor implements SessionChangedListener
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NAME
static int
PROXY_LISTENER_ORDER
static java.lang.String
SCRIPT_TYPE_PASSIVE
-
Constructor Summary
Constructors Constructor Description ExtensionPassiveScan()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
addPassiveScanner(PassiveScanner passiveScanner)
Adds the given passive scanner to the list of passive scanners that will be used to scan proxied messages.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.void
clearQueue()
Empties the passive scan queue without passively scanning the messages.void
destroy()
Performs final cleanups, free resources.java.util.List<java.lang.String>
getActiveActions()
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.Plugin.AlertThreshold
getAllScannerThreshold()
java.lang.String
getAuthor()
Gets the author of the extension.java.lang.String
getCurrentRuleName()
Deprecated.(2.12.0) use #getOldestRunningTask()long
getCurrentRuleStartTime()
Deprecated.(2.12.0) use #getOldestRunningTask()java.lang.String
getCurrentUrl()
Deprecated.(2.12.0) use #getOldestRunningTask()java.util.List<java.lang.Class<? extends Extension>>
getDependencies()
Gets the list ofExtension
s that this extension depends on.java.lang.String
getDescription()
Returns the description of the extension, to be shown in UI components.PassiveScanTask
getOldestRunningTask()
Returns the oldest running task (if any).protected PassiveScannerList
getPassiveScannerList()
PluginPassiveScanner
getPluginPassiveScanner(int id)
Gets thePluginPassiveScanner
with the given ID.java.util.List<PluginPassiveScanner>
getPluginPassiveScanners()
protected PolicyPassiveScanPanel
getPolicyPanel()
int
getRecordsToScan()
java.util.List<PassiveScanTask>
getRunningTasks()
protected ScanStatus
getScanStatus()
java.lang.String
getUIName()
By default returns the name returned bygetName()
.void
hook(ExtensionHook extensionHook)
Called during extension's initialisation to allow to add new functionality to core components.void
loadFrom(org.apache.commons.configuration.Configuration conf)
void
optionsLoaded()
Called after the options for this extension have been loaded, so that the extension can make use of them.boolean
removePassiveScanner(java.lang.String className)
boolean
removePassiveScanner(PassiveScanner passiveScanner)
Removes the given passive scanner from the list of passive scanners that are used to scan proxied messages.boolean
removePluginPassiveScanner(PluginPassiveScanner pluginPassiveScanner)
Removes the given plug-in passive scanner from the list of passive scanners that are used to scan proxied messages.void
saveTo(org.apache.commons.configuration.Configuration conf)
void
sessionAboutToChange(Session session)
Called just prior to the session changing.void
sessionChanged(Session session)
Called just after the session has changed.void
sessionModeChanged(Control.Mode mode)
Called when the user changes the mode.void
sessionScopeChanged(Session session)
Called when the user has changes the session scope.void
setAllScannerThreshold(Plugin.AlertThreshold at)
boolean
supportsDb(java.lang.String type)
No database tables used, so all supportedboolean
supportsLowMemory()
Return true it the extension can run with the 'low memory' option.-
Methods inherited from class org.parosproxy.paros.extension.ExtensionAdaptor
canUnload, databaseOpen, getAddOn, getExtensionMenu, getExtensionView, getI18nPrefix, getMessages, getModel, getName, getOrder, getUnsavedResources, getView, hasView, init, initModel, initView, initXML, isCore, isDepreciated, isEnabled, postInit, postInstall, setAddOn, setDescription, setEnabled, setI18nPrefix, setMessages, setName, setOrder, start, stop, unload
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.parosproxy.paros.extension.Extension
getURL, getVersion
-
Methods inherited from interface org.parosproxy.paros.extension.SessionChangedListener
sessionPropertiesChanged
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
SCRIPT_TYPE_PASSIVE
public static final java.lang.String SCRIPT_TYPE_PASSIVE
- See Also:
- Constant Field Values
-
PROXY_LISTENER_ORDER
public static final int PROXY_LISTENER_ORDER
- See Also:
- Constant Field Values
-
-
Method Detail
-
getUIName
public java.lang.String getUIName()
Description copied from class:ExtensionAdaptor
By default returns the name returned bygetName()
.- Specified by:
getUIName
in interfaceExtension
- Overrides:
getUIName
in classExtensionAdaptor
- Returns:
- the UI name of the extension, never
null
- See Also:
ExtensionAdaptor.getName()
-
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 interfaceExtension
- Overrides:
hook
in classExtensionAdaptor
- 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 interfaceExtension
- Overrides:
optionsLoaded
in classExtensionAdaptor
- 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 interfaceExtension
- Overrides:
getActiveActions
in classExtensionAdaptor
- Returns:
- a
List
containing the active actions ornull
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 methodaddPluginPassiveScanner(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 isnull
.- 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 isnull
.- 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 isnull
.- 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 isnull
.- See Also:
PluginPassiveScanner
-
getPassiveScannerList
protected PassiveScannerList getPassiveScannerList()
-
getPluginPassiveScanners
public java.util.List<PluginPassiveScanner> getPluginPassiveScanners()
-
getPluginPassiveScanner
public PluginPassiveScanner getPluginPassiveScanner(int id)
Gets thePluginPassiveScanner
with the given ID.- Parameters:
id
- the ID of the plugin.- Returns:
- the
PluginPassiveScanner
, ornull
if not found (e.g. not installed). - Since:
- 2.7.0
-
setAllScannerThreshold
public void setAllScannerThreshold(Plugin.AlertThreshold at)
- Parameters:
at
-
-
getAllScannerThreshold
public Plugin.AlertThreshold getAllScannerThreshold()
- Returns:
-
getPolicyPanel
protected PolicyPassiveScanPanel getPolicyPanel()
-
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 interfaceSessionChangedListener
- 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 interfaceSessionChangedListener
- 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 interfaceExtension
- Overrides:
destroy
in classExtensionAdaptor
-
getDependencies
public java.util.List<java.lang.Class<? extends Extension>> getDependencies()
Description copied from interface:Extension
Gets the list ofExtension
s that this extension depends on.- Specified by:
getDependencies
in interfaceExtension
- Overrides:
getDependencies
in classExtensionAdaptor
- 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 interfaceSessionChangedListener
- 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.
-
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 interfaceExtension
- Overrides:
getDescription
in classExtensionAdaptor
- 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 interfaceSessionChangedListener
- 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 interfaceExtension
- Overrides:
supportsLowMemory
in classExtensionAdaptor
- 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 interfaceExtension
- Overrides:
supportsDb
in classExtensionAdaptor
- 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()
-
-