Package org.zaproxy.zap.extension.ascan
Class ScriptsActiveScanner
- java.lang.Object
-
- org.parosproxy.paros.core.scanner.AbstractPlugin
-
- org.parosproxy.paros.core.scanner.AbstractAppPlugin
-
- org.parosproxy.paros.core.scanner.AbstractAppParamPlugin
-
- org.zaproxy.zap.extension.ascan.ScriptsActiveScanner
-
- All Implemented Interfaces:
java.lang.Comparable<java.lang.Object>
,java.lang.Runnable
,Plugin
,ExampleAlertProvider
public class ScriptsActiveScanner extends AbstractAppParamPlugin
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.parosproxy.paros.core.scanner.AbstractPlugin
AbstractPlugin.AlertBuilder
-
Nested classes/interfaces inherited from interface org.parosproxy.paros.core.scanner.Plugin
Plugin.AlertThreshold, Plugin.AttackStrength
-
-
Field Summary
-
Fields inherited from class org.parosproxy.paros.core.scanner.AbstractPlugin
CRLF, PATTERN_PARAM
-
-
Constructor Summary
Constructors Constructor Description ScriptsActiveScanner()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getCategory()
Gets the category of this scanner.int
getCweId()
Gets the CWE ID of the issue(s) raised by the scanner.java.lang.String[]
getDependency()
Returns no dependencies by default.java.lang.String
getDescription()
Default description of this plugin.int
getId()
Unique Paros ID of this plugin.java.lang.String
getName()
Plugin name.java.lang.String
getReference()
Reference document provided by this plugin.int
getRisk()
Gets the highest risk level of the alerts raised by the plugin.java.lang.String
getSolution()
Default solution returned by this plugin.int
getWascId()
Gets the WASC ID of the issue(s) raised by the scanner.void
init()
Finishes the initialisation of the plugin, subclasses should add any initialisation logic/code to this method.boolean
isPage200(HttpMessage msg)
Tells whether or not the message matchesCustomPage.Type.OK_200
definitions.boolean
isPage404(HttpMessage msg)
Tells whether or not the message matches aCustomPage.Type.NOTFOUND_404
definition.boolean
isPage500(HttpMessage msg)
Tells whether or not the message matchesCustomPage.Type.ERROR_500
definitions.boolean
isPageOther(HttpMessage msg)
Tells whether or not the message matchesCustomPage.Type.OTHER
definitions.boolean
isStop()
Check if this test should be stopped.AbstractPlugin.AlertBuilder
newAlert()
Returns a new alert builder.void
raiseAlert(int risk, int confidence, java.lang.String name, java.lang.String description, java.lang.String uri, java.lang.String param, java.lang.String attack, java.lang.String otherInfo, java.lang.String solution, java.lang.String evidence, int cweId, int wascId, HttpMessage msg)
Deprecated.(2.9.0) UsenewAlert()
to build andraise
alerts.void
raiseAlert(int risk, int confidence, java.lang.String name, java.lang.String description, java.lang.String uri, java.lang.String param, java.lang.String attack, java.lang.String otherInfo, java.lang.String solution, java.lang.String evidence, java.lang.String reference, int cweId, int wascId, HttpMessage msg)
Deprecated.(2.9.0) UsenewAlert()
to build andraise
alerts.void
scan()
Scans the target server using the message previously set during initialisation.void
scan(HttpMessage msg, java.lang.String param, java.lang.String value)
Plugin method that need to be implemented for the specific test.void
sendAndReceive(HttpMessage msg)
Sends and receives the givenmessage
, always following redirections.void
sendAndReceive(HttpMessage msg, boolean isFollowRedirect)
Sends and receives the givenmessage
, optionally following redirections.void
sendAndReceive(HttpMessage msg, boolean isFollowRedirect, boolean handleAntiCSRF)
Sends and receives the givenmessage
, optionally following redirections and optionally regenerating anti-CSRF token, if any.java.lang.String
setParam(HttpMessage msg, java.lang.String param, java.lang.String value)
-
Methods inherited from class org.parosproxy.paros.core.scanner.AbstractAppParamPlugin
getBuilder, scan, scan, setEscapedParameter, setParameter, setParameters
-
Methods inherited from class org.parosproxy.paros.core.scanner.AbstractAppPlugin
notifyPluginCompleted
-
Methods inherited from class org.parosproxy.paros.core.scanner.AbstractPlugin
bingo, bingo, bingo, bingo, bingo, bingo, cloneInto, compareTo, createParamIfNotExist, equals, getAlertTags, getAlertThreshold, getAlertThreshold, getAlertThresholdsSupported, getAttackStrength, getAttackStrength, getAttackStrengthsSupported, getBaseMsg, getCodeName, getConfig, getDelayInMs, getDisplayName, getHTMLEncode, getKb, getLog, getLogger, getNewMsg, getParent, getProperty, getStatus, getTechSet, getTimeFinished, getTimeStarted, getURLDecode, getURLEncode, hashCode, init, inScope, isAnyInScope, isClientError, isDepreciated, isEnabled, isFileExist, isPageAuthIssue, isServerError, isSuccess, isVisible, loadFrom, matchBodyPattern, matchHeaderPattern, run, saveTo, setAlertThreshold, setAttackStrength, setConfig, setDefaultAlertThreshold, setDefaultAttackStrength, setDelayInMs, setEnabled, setProperty, setStatus, setTechSet, setTimeFinished, setTimeStarted, stripOff, targets, updateRequestContentLength, writeProgress
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.parosproxy.paros.core.scanner.Plugin
getExampleAlerts
-
-
-
-
Method Detail
-
getId
public int getId()
Description copied from interface:Plugin
Unique Paros ID of this plugin.- Returns:
- the ID
-
getName
public java.lang.String getName()
Description copied from interface:Plugin
Plugin name. This is the human readable plugin name for display.- Returns:
- the internationalised name
-
getDependency
public java.lang.String[] getDependency()
Description copied from class:AbstractPlugin
Returns no dependencies by default.- Specified by:
getDependency
in interfacePlugin
- Overrides:
getDependency
in classAbstractPlugin
- Returns:
- an empty array (that is, no dependencies)
-
getDescription
public java.lang.String getDescription()
Description copied from interface:Plugin
Default description of this plugin.- Returns:
- the description
-
getCategory
public int getCategory()
Description copied from interface:Plugin
Gets the category of this scanner.- Returns:
- the category of the scanner
- See Also:
Category
-
getSolution
public java.lang.String getSolution()
Description copied from interface:Plugin
Default solution returned by this plugin.- Returns:
- the solution
-
getReference
public java.lang.String getReference()
Description copied from interface:Plugin
Reference document provided by this plugin.- Returns:
- the references
-
init
public void init()
Description copied from class:AbstractPlugin
Finishes the initialisation of the plugin, subclasses should add any initialisation logic/code to this method.Called after the plugin has been initialised with the message being scanned. By default it does nothing.
Since 2.5.0 it is no longer abstract.
- Overrides:
init
in classAbstractPlugin
- See Also:
AbstractPlugin.init(HttpMessage, HostProcess)
-
scan
public void scan()
Description copied from interface:Plugin
Scans the target server using the message previously set during initialisation.- Specified by:
scan
in interfacePlugin
- Overrides:
scan
in classAbstractAppParamPlugin
- See Also:
Plugin.init(HttpMessage, HostProcess)
-
scan
public void scan(HttpMessage msg, java.lang.String param, java.lang.String value)
Description copied from class:AbstractAppParamPlugin
Plugin method that need to be implemented for the specific test. The passed message is a copy which maintains only the Request's information so if the plugin need to manage the original Response body a getBaseMsg() call should be done. the param name and the value are the original value retrieved by the crawler and the current applied Variant.- Overrides:
scan
in classAbstractAppParamPlugin
- Parameters:
msg
- a copy of the HTTP message currently under scanningparam
- the name of the parameter under testingvalue
- the clean value (no escaping is needed)
-
isStop
public boolean isStop()
Description copied from class:AbstractPlugin
Check if this test should be stopped. It should be checked periodically in Plugin (e.g. when in loops) so the HostProcess can stop this Plugin cleanly.- Overrides:
isStop
in classAbstractPlugin
- Returns:
true
if the scanner should stop,false
otherwise
-
setParam
public java.lang.String setParam(HttpMessage msg, java.lang.String param, java.lang.String value)
-
sendAndReceive
public void sendAndReceive(HttpMessage msg) throws java.io.IOException
Description copied from class:AbstractPlugin
Sends and receives the givenmessage
, always following redirections.The following changes are made to the request before being sent:
- The anti-CSRF token contained in the message will be handled/regenerated, if any;
- The request headers
HttpHeader.IF_MODIFIED_SINCE
andHttpHeader.IF_NONE_MATCH
are removed, to always obtain a fresh response; - The header
HttpHeader.CONTENT_LENGTH
is updated, to match the length of the request body. - Changes done by
HttpSenderListener
(for example, scripts).
- Overrides:
sendAndReceive
in classAbstractPlugin
- Parameters:
msg
- the message to be sent and received- Throws:
java.io.IOException
- if an I/O error occurred (for example, read time out)- See Also:
AbstractPlugin.sendAndReceive(HttpMessage, boolean)
,AbstractPlugin.sendAndReceive(HttpMessage, boolean, boolean)
-
sendAndReceive
public void sendAndReceive(HttpMessage msg, boolean isFollowRedirect) throws java.io.IOException
Description copied from class:AbstractPlugin
Sends and receives the givenmessage
, optionally following redirections.The following changes are made to the request before being sent:
- The anti-CSRF token contained in the message will be handled/regenerated, if any;
- The request headers
HttpHeader.IF_MODIFIED_SINCE
andHttpHeader.IF_NONE_MATCH
are removed, to always obtain a fresh response; - The header
HttpHeader.CONTENT_LENGTH
is updated, to match the length of the request body. - Changes done by
HttpSenderListener
(for example, scripts).
- Overrides:
sendAndReceive
in classAbstractPlugin
- Parameters:
msg
- the message to be sent and receivedisFollowRedirect
-true
if redirections should be followed,false
otherwise- Throws:
java.io.IOException
- if an I/O error occurred (for example, read time out)- See Also:
AbstractPlugin.sendAndReceive(HttpMessage)
,AbstractPlugin.sendAndReceive(HttpMessage, boolean, boolean)
-
sendAndReceive
public void sendAndReceive(HttpMessage msg, boolean isFollowRedirect, boolean handleAntiCSRF) throws java.io.IOException
Description copied from class:AbstractPlugin
Sends and receives the givenmessage
, optionally following redirections and optionally regenerating anti-CSRF token, if any.The following changes are made to the request before being sent:
- The request headers
HttpHeader.IF_MODIFIED_SINCE
andHttpHeader.IF_NONE_MATCH
are removed, to always obtain a fresh response; - The header
HttpHeader.CONTENT_LENGTH
is updated, to match the length of the request body. - Changes done by
HttpSenderListener
(for example, scripts).
- Overrides:
sendAndReceive
in classAbstractPlugin
- Parameters:
msg
- the message to be sent and receivedisFollowRedirect
-true
if redirections should be followed,false
otherwisehandleAntiCSRF
-true
if the anti-CSRF token present in the request should be handled/regenerated,false
otherwise- Throws:
java.io.IOException
- if an I/O error occurred (for example, read time out)- See Also:
AbstractPlugin.sendAndReceive(HttpMessage)
,AbstractPlugin.sendAndReceive(HttpMessage, boolean)
- The request headers
-
newAlert
public AbstractPlugin.AlertBuilder newAlert()
Description copied from class:AbstractAppParamPlugin
Returns a new alert builder.By default the alert builder sets the following fields of the alert:
- Plugin ID - using
Plugin.getId()
- Name - using
Plugin.getName()
- Risk - using
AbstractPlugin.getRisk()
- Description - using
Plugin.getDescription()
- Solution - using
Plugin.getSolution()
- Reference - using
Plugin.getReference()
- CWE ID - using
AbstractPlugin.getCweId()
- WASC ID - using
AbstractPlugin.getWascId()
- URI - from the alert message
- Alert Tags - using
AbstractPlugin.getAlertTags()
Since 2.12.0 it also sets the input vector and parameter.
- Overrides:
newAlert
in classAbstractAppParamPlugin
- Returns:
- the alert builder.
- Since:
- 2.9.0
- Plugin ID - using
-
raiseAlert
@Deprecated public void raiseAlert(int risk, int confidence, java.lang.String name, java.lang.String description, java.lang.String uri, java.lang.String param, java.lang.String attack, java.lang.String otherInfo, java.lang.String solution, java.lang.String evidence, int cweId, int wascId, HttpMessage msg)
Deprecated.(2.9.0) UsenewAlert()
to build andraise
alerts.
-
raiseAlert
@Deprecated public void raiseAlert(int risk, int confidence, java.lang.String name, java.lang.String description, java.lang.String uri, java.lang.String param, java.lang.String attack, java.lang.String otherInfo, java.lang.String solution, java.lang.String evidence, java.lang.String reference, int cweId, int wascId, HttpMessage msg)
Deprecated.(2.9.0) UsenewAlert()
to build andraise
alerts.
-
getRisk
public int getRisk()
Description copied from interface:Plugin
Gets the highest risk level of the alerts raised by the plugin.- Specified by:
getRisk
in interfacePlugin
- Overrides:
getRisk
in classAbstractPlugin
- Returns:
- the highest risk level of the alerts raised by the plugin.
- See Also:
Alert.RISK_HIGH
,Alert.RISK_MEDIUM
,Alert.RISK_LOW
,Alert.RISK_INFO
-
getCweId
public int getCweId()
Description copied from interface:Plugin
Gets the CWE ID of the issue(s) raised by the scanner.- Specified by:
getCweId
in interfacePlugin
- Overrides:
getCweId
in classAbstractPlugin
- Returns:
- the CWE ID, -1 if unknown.
- See Also:
- CWE - Common Weakness Enumeration
-
getWascId
public int getWascId()
Description copied from interface:Plugin
Gets the WASC ID of the issue(s) raised by the scanner.- Specified by:
getWascId
in interfacePlugin
- Overrides:
getWascId
in classAbstractPlugin
- Returns:
- the WASC ID, -1 if unknown.
- See Also:
- The WASC Threat Classification
-
isPage200
public boolean isPage200(HttpMessage msg)
Description copied from class:AbstractPlugin
Tells whether or not the message matchesCustomPage.Type.OK_200
definitions. Falls back to useAnalyser
which analyzes specific behavior and status codes. Checks if the message matchesCustomPage.Type.ERROR_500
orCusotmPage.Type.NOTFOUND_404
first, in case the user is trying to override something.- Overrides:
isPage200
in classAbstractPlugin
- Parameters:
msg
- the message that will be checked- Returns:
true
if the message matches,false
otherwise
-
isPage404
public boolean isPage404(HttpMessage msg)
Description copied from class:AbstractPlugin
Tells whether or not the message matches aCustomPage.Type.NOTFOUND_404
definition. Falls back toAnalyser
. Checks if the message matchesCustomPage.Type.OK_200
orCustomPage.Type.ERROR_500
first, in case the user is trying to override something.- Overrides:
isPage404
in classAbstractPlugin
- Parameters:
msg
- the message that will be checked- Returns:
true
if the message matches,false
otherwise
-
isPage500
public boolean isPage500(HttpMessage msg)
Description copied from class:AbstractPlugin
Tells whether or not the message matchesCustomPage.Type.ERROR_500
definitions. Falls back to simply checking the response status code for "500 - Internal Server Error". Checks if the message matchesCustomPage.Type.OK_200
orCusotmPage.Type.NOTFOUND_404
first, in case the user is trying to override something.- Overrides:
isPage500
in classAbstractPlugin
- Parameters:
msg
- the message that will be checked- Returns:
true
if the message matches,false
otherwise
-
isPageOther
public boolean isPageOther(HttpMessage msg)
Description copied from class:AbstractPlugin
Tells whether or not the message matchesCustomPage.Type.OTHER
definitions.- Overrides:
isPageOther
in classAbstractPlugin
- Parameters:
msg
- the message that will be checked- Returns:
true
if the message matches,false
otherwise
-
-