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)));
}
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;
}
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)));
}
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());
}
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
}
Aggregations