public class SpiderScan extends Object implements ScanListenner, SpiderListener, GenericScanner2
Constructor and Description |
---|
SpiderScan(ExtensionSpider extension,
SpiderParam spiderParams,
Target target,
org.apache.commons.httpclient.URI spiderURI,
User scanUser,
int scanId)
Deprecated.
(2.6.0) Use
SpiderScan(ExtensionSpider, SpiderParam, Target, URI, User,
int, String) instead. |
SpiderScan(ExtensionSpider extension,
SpiderParam spiderParams,
Target target,
org.apache.commons.httpclient.URI spiderURI,
User scanUser,
int scanId,
String name)
Constructs a
SpiderScan with the given data. |
Modifier and Type | Method and Description |
---|---|
void |
foundURI(String uri,
String method,
FetchFilter.FetchStatus status)
Event triggered when a new uri was found.
|
SpiderPanelTableModel |
getAddedNodesTableModel() |
String |
getDisplayName() |
int |
getMaximum() |
int |
getNumberOfNodesAdded() |
int |
getNumberOfURIsFound()
Gets the number of URIs, in and out of scope, found during the scan.
|
int |
getProgress()
Returns the progress of the scan, an integer between 0 and 100.
|
List<SpiderResource> |
getResourcesFound()
Returns the resources found during the scan.
|
List<SpiderResource> |
getResourcesIoErrors()
Returns the resources found during the scan that were not successfully obtained because of
I/O errors.
|
Set<String> |
getResults()
Returns the URLs found during the scan.
|
Set<String> |
getResultsOutOfScope()
Returns the URLs, out of scope, found during the scan.
|
TableModel |
getResultsTableModel() |
int |
getScanId()
Returns the ID of the scan.
|
String |
getState()
Returns the
String representation of the scan state (not started, running, paused or
finished). |
boolean |
isPaused() |
boolean |
isRunning() |
boolean |
isStopped() |
void |
notifySpiderTaskResult(SpiderTaskResult spiderTaskResult)
Notifies that a new
SpiderTask 's result is available. |
void |
pauseScan()
Pauses the scan.
|
void |
resumeScan()
Resumes the scan.
|
void |
run() |
void |
scanFinshed(String host) |
void |
scanProgress(String host,
int progress,
int maximum) |
void |
setCustomFetchFilters(List<FetchFilter> customFetchFilters) |
void |
setCustomParseFilters(List<ParseFilter> customParseFilters) |
void |
setCustomSpiderParsers(List<SpiderParser> customSpiderParsers) |
void |
setDisplayName(String name) |
void |
setListener(ScanListenner2 listener) |
void |
setScanId(int id) |
void |
spiderComplete(boolean successful)
Event triggered when the spider is finished.
|
void |
spiderProgress(int percentageComplete,
int numberCrawled,
int numberToCrawl)
Event triggered when the Spider progress has changed.
|
void |
start()
Starts the scan.
|
void |
stopScan()
Stops the scan.
|
@Deprecated public SpiderScan(ExtensionSpider extension, SpiderParam spiderParams, Target target, org.apache.commons.httpclient.URI spiderURI, User scanUser, int scanId)
SpiderScan(ExtensionSpider, SpiderParam, Target, URI, User,
int, String)
instead.SpiderScan
with the given data.extension
- the extension to obtain configurations and notify the viewspiderParams
- the spider optionstarget
- the spider targetspiderURI
- the starting URI, may be null
.scanUser
- the user to be used in the scan, may be null
.scanId
- the ID of the scanpublic SpiderScan(ExtensionSpider extension, SpiderParam spiderParams, Target target, org.apache.commons.httpclient.URI spiderURI, User scanUser, int scanId, String name)
SpiderScan
with the given data.extension
- the extension to obtain configurations and notify the viewspiderParams
- the spider optionstarget
- the spider targetspiderURI
- the starting URI, may be null
.scanUser
- the user to be used in the scan, may be null
.scanId
- the ID of the scanname
- the name that identifies the targetpublic int getScanId()
getScanId
in interface GenericScanner2
public String getState()
String
representation of the scan state (not started, running, paused or
finished).String
representation of the scan state.public int getProgress()
getProgress
in interface GenericScanner2
public void start()
The call to this method has no effect if the scan was already started.
public void pauseScan()
The call to this method has no effect if the scan is not running.
pauseScan
in interface GenericScanner2
public void resumeScan()
The call to this method has no effect if the scan is not paused.
resumeScan
in interface GenericScanner2
public void stopScan()
The call to this method has no effect if the scan was not yet started or has already finished.
stopScan
in interface GenericScanner2
public Set<String> getResults()
Note: Iterations must be synchronized
on returned object. Failing
to do so might result in ConcurrentModificationException
.
ConcurrentModificationException
public List<SpiderResource> getResourcesFound()
Note: Iterations must be synchronized
on returned object. Failing
to do so might result in ConcurrentModificationException
.
ConcurrentModificationException
public List<SpiderResource> getResourcesIoErrors()
Note: Iterations must be synchronized
on returned object. Failing
to do so might result in ConcurrentModificationException
.
public Set<String> getResultsOutOfScope()
Note: Iterations must be synchronized
on returned object. Failing
to do so might result in ConcurrentModificationException
.
ConcurrentModificationException
public void notifySpiderTaskResult(SpiderTaskResult spiderTaskResult)
SpiderListener
SpiderTask
's result is available.notifySpiderTaskResult
in interface SpiderListener
spiderTaskResult
- the result of the spider task.public void spiderComplete(boolean successful)
SpiderListener
successful
is
true
, either when it was stopped by an user in which case the successful
parameter is false.spiderComplete
in interface SpiderListener
successful
- public void spiderProgress(int percentageComplete, int numberCrawled, int numberToCrawl)
SpiderListener
spiderProgress
in interface SpiderListener
percentageComplete
- the percentage completenumberCrawled
- the number of pages crawlednumberToCrawl
- the number of pages left to crawlpublic void foundURI(String uri, String method, FetchFilter.FetchStatus status)
SpiderListener
status
parameter says if the URI
was skipped according to any skip rule or it was processed.foundURI
in interface SpiderListener
uri
- the urimethod
- the method used for accessing the uristatus
- the FetchFilter.FetchStatus
stating if this uri will be processed, and, if not,
stating the reason of the filteringpublic void setScanId(int id)
setScanId
in interface GenericScanner2
public void setDisplayName(String name)
setDisplayName
in interface GenericScanner2
public String getDisplayName()
getDisplayName
in interface GenericScanner2
public boolean isStopped()
isStopped
in interface GenericScanner2
public int getMaximum()
getMaximum
in interface GenericScanner2
public int getNumberOfURIsFound()
public int getNumberOfNodesAdded()
public boolean isPaused()
isPaused
in interface GenericScanner2
public boolean isRunning()
isRunning
in interface GenericScanner2
public void scanFinshed(String host)
scanFinshed
in interface ScanListenner
public void scanProgress(String host, int progress, int maximum)
scanProgress
in interface ScanListenner
public TableModel getResultsTableModel()
public SpiderPanelTableModel getAddedNodesTableModel()
public void setListener(ScanListenner2 listener)
public void setCustomSpiderParsers(List<SpiderParser> customSpiderParsers)
public void setCustomFetchFilters(List<FetchFilter> customFetchFilters)
public void setCustomParseFilters(List<ParseFilter> customParseFilters)