Search in sources :

Example 1 with SpiderListener

use of org.zaproxy.zap.spider.SpiderListener in project zaproxy by zaproxy.

the class SpiderThread method startSpider.

/**
	 * Start spider.
	 */
private void startSpider() {
    spider = new Spider(id, extension, spiderParams, extension.getModel().getOptionsParam().getConnectionParam(), extension.getModel(), this.scanContext);
    // Register this thread as a Spider Listener, so it gets notified of events and is able
    // to manipulate the UI accordingly
    spider.addSpiderListener(this);
    // Add the pending listeners
    for (SpiderListener l : pendingSpiderListeners) {
        spider.addSpiderListener(l);
    }
    // Add the list of (regex) URIs that should be excluded
    List<String> excludeList = new ArrayList<>();
    excludeList.addAll(extension.getExcludeList());
    excludeList.addAll(extension.getModel().getSession().getExcludeFromSpiderRegexs());
    excludeList.addAll(extension.getModel().getSession().getGlobalExcludeURLRegexs());
    spider.setExcludeList(excludeList);
    // Add seeds accordingly
    addSeeds();
    spider.setScanAsUser(scanUser);
    // Add any custom parsers and filters specified
    if (this.customSpiderParsers != null) {
        for (SpiderParser sp : this.customSpiderParsers) {
            spider.addCustomParser(sp);
        }
    }
    if (this.customFetchFilters != null) {
        for (FetchFilter ff : this.customFetchFilters) {
            spider.addFetchFilter(ff);
        }
    }
    if (this.customParseFilters != null) {
        for (ParseFilter pf : this.customParseFilters) {
            spider.addParseFilter(pf);
        }
    }
    // Start the spider
    spider.start();
}
Also used : SpiderListener(org.zaproxy.zap.spider.SpiderListener) ParseFilter(org.zaproxy.zap.spider.filters.ParseFilter) Spider(org.zaproxy.zap.spider.Spider) ArrayList(java.util.ArrayList) SpiderParser(org.zaproxy.zap.spider.parser.SpiderParser) FetchFilter(org.zaproxy.zap.spider.filters.FetchFilter)

Aggregations

ArrayList (java.util.ArrayList)1 Spider (org.zaproxy.zap.spider.Spider)1 SpiderListener (org.zaproxy.zap.spider.SpiderListener)1 FetchFilter (org.zaproxy.zap.spider.filters.FetchFilter)1 ParseFilter (org.zaproxy.zap.spider.filters.ParseFilter)1 SpiderParser (org.zaproxy.zap.spider.parser.SpiderParser)1