Search in sources :

Example 16 with SpiderParam

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

the class SpiderHtmlParserUnitTest method shouldNotParseHtmlResponseIfAlreadyParsed.

@Test
public void shouldNotParseHtmlResponseIfAlreadyParsed() {
    // Given
    SpiderHtmlParser htmlParser = new SpiderHtmlParser(new SpiderParam());
    HttpMessage messageHtmlResponse = createMessageWith("NoURLsSpiderHtmlParser.html");
    boolean parsed = true;
    // When
    boolean canParse = htmlParser.canParseResource(messageHtmlResponse, ROOT_PATH, parsed);
    // Then
    assertThat(canParse, is(equalTo(false)));
}
Also used : SpiderParam(org.zaproxy.zap.spider.SpiderParam) HttpMessage(org.parosproxy.paros.network.HttpMessage) Test(org.junit.Test)

Example 17 with SpiderParam

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

the class SpiderParserTestUtils method createSpiderParamWithConfig.

protected static SpiderParam createSpiderParamWithConfig() {
    SpiderParam spiderParam = new SpiderParam();
    spiderParam.load(new ZapXmlConfiguration());
    return spiderParam;
}
Also used : SpiderParam(org.zaproxy.zap.spider.SpiderParam) ZapXmlConfiguration(org.zaproxy.zap.utils.ZapXmlConfiguration)

Example 18 with SpiderParam

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

the class SpiderSitemapXMLParserUnitTest method shouldNotParseMessageIfParseOfSitemapXmlIsDisabled.

@Test
public void shouldNotParseMessageIfParseOfSitemapXmlIsDisabled() {
    // Given
    SpiderParam params = createSpiderParamWithConfig();
    params.setParseSitemapXml(false);
    SpiderSitemapXMLParser spiderParser = new SpiderSitemapXMLParser(params);
    HttpMessage message = createMessageWith("NoUrlsSitemap.xml");
    // When
    boolean completelyParsed = spiderParser.parseResource(message, null, BASE_DEPTH);
    // Then
    assertThat(completelyParsed, is(equalTo(false)));
}
Also used : SpiderParam(org.zaproxy.zap.spider.SpiderParam) HttpMessage(org.parosproxy.paros.network.HttpMessage) Test(org.junit.Test)

Example 19 with SpiderParam

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

the class OptionsSpiderPanel method saveParam.

@Override
public void saveParam(Object obj) throws Exception {
    OptionsParam options = (OptionsParam) obj;
    SpiderParam param = options.getParamSet(SpiderParam.class);
    param.setMaxDepth(getSliderMaxDepth().getValue());
    param.setThreadCount(getSliderThreads().getValue());
    param.setMaxDuration(getDurationNumberSpinner().getValue());
    param.setMaxChildren(getMaxChildrenNumberSpinner().getValue());
    param.setDomainsAlwaysInScope(getDomainsAlwaysInScopeTableModel().getDomainsAlwaysInScope());
    param.setConfirmRemoveDomainAlwaysInScope(getDomainsAlwaysInScopePanel().isRemoveWithoutConfirmation());
    param.setSendRefererHeader(getChkSendRefererHeader().isSelected());
    param.setProcessForm(getChkProcessForm().isSelected());
    param.setPostForm(getChkPostForm().isSelected());
    param.setParseComments(getChkParseComments().isSelected());
    param.setParseRobotsTxt(getChkParseRobotsTxt().isSelected());
    param.setParseSitemapXml(getChkParseSitemapXml().isSelected());
    param.setParseSVNEntries(getChkParseSVNEntries().isSelected());
    param.setParseGit(getChkParseGit().isSelected());
    param.setHandleParameters((HandleParametersOption) getComboHandleParameters().getSelectedItem());
    param.setHandleODataParametersVisited(getHandleODataSpecificParameters().isSelected());
}
Also used : OptionsParam(org.parosproxy.paros.model.OptionsParam) SpiderParam(org.zaproxy.zap.spider.SpiderParam)

Example 20 with SpiderParam

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

the class SpiderHtmlFormParserUnitTest method shouldFailToCreateParserWithUndefinedSpiderOptions.

@Test(expected = IllegalArgumentException.class)
public void shouldFailToCreateParserWithUndefinedSpiderOptions() {
    // Given
    SpiderParam undefinedSpiderOptions = null;
    // When
    new SpiderHtmlFormParser(undefinedSpiderOptions, new DefaultValueGenerator());
// Then = IllegalArgumentException
}
Also used : DefaultValueGenerator(org.zaproxy.zap.model.DefaultValueGenerator) SpiderParam(org.zaproxy.zap.spider.SpiderParam) Test(org.junit.Test)

Aggregations

SpiderParam (org.zaproxy.zap.spider.SpiderParam)39 Test (org.junit.Test)32 HttpMessage (org.parosproxy.paros.network.HttpMessage)29 Source (net.htmlparser.jericho.Source)24 DefaultValueGenerator (org.zaproxy.zap.model.DefaultValueGenerator)5 ArrayList (java.util.ArrayList)2 OptionsParam (org.parosproxy.paros.model.OptionsParam)2 URI (org.apache.commons.httpclient.URI)1 ScannerParam (org.parosproxy.paros.core.scanner.ScannerParam)1 ConnectionParam (org.parosproxy.paros.network.ConnectionParam)1 AntiCsrfAPI (org.zaproxy.zap.extension.anticsrf.AntiCsrfAPI)1 AntiCsrfParam (org.zaproxy.zap.extension.anticsrf.AntiCsrfParam)1 ActiveScanAPI (org.zaproxy.zap.extension.ascan.ActiveScanAPI)1 AuthenticationAPI (org.zaproxy.zap.extension.authentication.AuthenticationAPI)1 AuthorizationAPI (org.zaproxy.zap.extension.authorization.AuthorizationAPI)1 AutoUpdateAPI (org.zaproxy.zap.extension.autoupdate.AutoUpdateAPI)1 OptionsParamCheckForUpdates (org.zaproxy.zap.extension.autoupdate.OptionsParamCheckForUpdates)1 BreakAPI (org.zaproxy.zap.extension.brk.BreakAPI)1 ForcedUserAPI (org.zaproxy.zap.extension.forceduser.ForcedUserAPI)1 HttpSessionsAPI (org.zaproxy.zap.extension.httpsessions.HttpSessionsAPI)1