Class PassiveScanController
- java.lang.Object
-
- java.lang.Thread
-
- org.zaproxy.zap.extension.pscan.PassiveScanController
-
- All Implemented Interfaces:
java.lang.Runnable
,ArrangeableProxyListener
,ProxyListener
public class PassiveScanController extends java.lang.Thread implements ProxyListener
Controls the passive scanning.- Since:
- 2.12.0
-
-
Constructor Summary
Constructors Constructor Description PassiveScanController(ExtensionPassiveScan extPscan, ExtensionHistory extHistory, ExtensionAlert extAlert, PassiveScanParam passiveScanParam, ScanStatus scanStatus)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearQueue()
Empties the passive scan queue without passively scanning the messages.int
getArrangeableListenerOrder()
Gets the order of when this listener should be notified.PassiveScanTask
getOldestRunningTask()
protected int
getRecordsToScan()
java.util.List<PassiveScanTask>
getRunningTasks()
boolean
onHttpRequestSend(HttpMessage msg)
Notifies the listener that a new request was received from the client and is ready to be forwarded to the server.boolean
onHttpResponseReceive(HttpMessage msg)
Notifies the listener that a new response was received from the server and is ready to be forwarded to the client.void
run()
void
setSession(Session session)
protected void
shutdown()
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
PassiveScanController
public PassiveScanController(ExtensionPassiveScan extPscan, ExtensionHistory extHistory, ExtensionAlert extAlert, PassiveScanParam passiveScanParam, ScanStatus scanStatus)
-
-
Method Detail
-
setSession
public void setSession(Session session)
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
getRecordsToScan
protected int getRecordsToScan()
-
shutdown
protected void shutdown()
-
getRunningTasks
public java.util.List<PassiveScanTask> getRunningTasks()
-
getOldestRunningTask
public PassiveScanTask getOldestRunningTask()
-
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
-
getArrangeableListenerOrder
public int getArrangeableListenerOrder()
Description copied from interface:ArrangeableProxyListener
Gets the order of when this listener should be notified.The listeners are ordered in a natural order, the greater the order the later it will be notified.
Note: If two or more listeners have the same order, the order that those listeners will be notified is undefined.
- Specified by:
getArrangeableListenerOrder
in interfaceArrangeableProxyListener
- Returns:
- an
int
with the value of the order that this listener should be notified about
-
onHttpRequestSend
public boolean onHttpRequestSend(HttpMessage msg)
Description copied from interface:ProxyListener
Notifies the listener that a new request was received from the client and is ready to be forwarded to the server.The
HttpMessage
msg
can be modified, if the response is set it will be used instead of forwarding the request to the server. If the return value istrue
the message may be forwarded and the following listeners will be notified, if the value isfalse
the message will not be forwarded and no more listeners will be notified.Note: In the presence of more than one listener there are no guarantees that:
- the
HttpMessage
msg
is equal to the one forwarded to the server, as the following listeners may modify it; - the response set is the one forwarded to the client, as the following listeners may clear or modify it;
- the message will really be forwarded to the server, even if the return value is
true
, as the following listeners may returnfalse
.
- Specified by:
onHttpRequestSend
in interfaceProxyListener
- Parameters:
msg
- theHttpMessage
that may be forwarded to the server- Returns:
true
if the message should be forwarded to the server,false
otherwise
- the
-
onHttpResponseReceive
public boolean onHttpResponseReceive(HttpMessage msg)
Description copied from interface:ProxyListener
Notifies the listener that a new response was received from the server and is ready to be forwarded to the client.The
HttpMessage
msg
can be modified (only the response should be modified). If the return value istrue
the message may be forwarded and the following listeners will be notified, if the value isfalse
the message will not be forwarded and no more listeners will be notified.Note: In the presence of more than one listener there are no guarantees that:
- the
HttpMessage
msg
is equal to the one forwarded to the client, as the following listeners may modify it; - the message will really be forwarded to the client, even if the return value is
true
, as the following listeners may returnfalse
.
- Specified by:
onHttpResponseReceive
in interfaceProxyListener
- Parameters:
msg
- theHttpMessage
that may be forwarded to the client- Returns:
true
if the message should be forwarded to the client,false
otherwise
- the
-
-