use of org.zaproxy.zap.extension.pscan.scanner.RegexAutoTagScanner in project zaproxy by zaproxy.
the class PassiveScanParam method parse.
@Override
protected void parse() {
try {
List<HierarchicalConfiguration> fields = ((HierarchicalConfiguration) getConfig()).configurationsAt(ALL_AUTO_TAG_SCANNERS_KEY);
this.autoTagScanners = new ArrayList<>(fields.size());
List<String> tempListNames = new ArrayList<>(fields.size());
for (HierarchicalConfiguration sub : fields) {
String name = sub.getString(AUTO_TAG_SCANNER_NAME_KEY, "");
if (!"".equals(name) && !tempListNames.contains(name)) {
tempListNames.add(name);
RegexAutoTagScanner app = new RegexAutoTagScanner(sub.getString(AUTO_TAG_SCANNER_NAME_KEY), RegexAutoTagScanner.TYPE.valueOf(sub.getString(AUTO_TAG_SCANNER_TYPE_KEY)), sub.getString(AUTO_TAG_SCANNER_CONFIG_KEY), sub.getString(AUTO_TAG_SCANNER_REQ_URL_REGEX_KEY), sub.getString(AUTO_TAG_SCANNER_REQ_HEAD_REGEX_KEY), sub.getString(AUTO_TAG_SCANNER_RES_HEAD_REGEX_KEY), sub.getString(AUTO_TAG_SCANNER_RES_BODY_REGEX_KEY), sub.getBoolean(AUTO_TAG_SCANNER_ENABLED_KEY, true));
autoTagScanners.add(app);
}
}
} catch (ConversionException e) {
logger.error("Error while loading the auto tag scanners: " + e.getMessage(), e);
}
try {
this.confirmRemoveAutoTagScanner = getConfig().getBoolean(CONFIRM_REMOVE_AUTO_TAG_SCANNER_KEY, true);
} catch (ConversionException e) {
logger.error("Error while loading the confirm remove option: " + e.getMessage(), e);
}
try {
this.scanOnlyInScope = getConfig().getBoolean(SCAN_ONLY_IN_SCOPE_KEY, false);
} catch (ConversionException e) {
logger.error("Error while loading \"scanOnlyInScope\" option: " + e.getMessage(), e);
}
}
use of org.zaproxy.zap.extension.pscan.scanner.RegexAutoTagScanner in project zaproxy by zaproxy.
the class ExtensionPassiveScan method addPluginPassiveScannerImpl.
private boolean addPluginPassiveScannerImpl(PluginPassiveScanner scanner) {
if (scanner instanceof RegexAutoTagScanner) {
return false;
}
boolean added = false;
try {
FileConfiguration config = this.getModel().getOptionsParam().getConfig();
scanner.setConfig(config);
added = addPassiveScannerImpl(scanner);
if (View.isInitialised()) {
getPolicyPanel().getPassiveScanTableModel().addScanner(scanner);
}
logger.info("loaded passive scan rule: " + scanner.getName());
if (scanner.getPluginId() == -1) {
logger.error("The passive scan rule \"" + scanner.getName() + "\" [" + scanner.getClass().getCanonicalName() + "] does not have a defined ID.");
}
} catch (Exception e) {
logger.error("Failed to load passive scanner " + scanner.getName(), e);
}
return added;
}
use of org.zaproxy.zap.extension.pscan.scanner.RegexAutoTagScanner in project zaproxy by zaproxy.
the class OptionsPassiveScanTableModel method setScanDefns.
/**
* @param defns
*/
public void setScanDefns(List<RegexAutoTagScanner> defns) {
this.defns = new ArrayList<>(defns.size());
for (RegexAutoTagScanner def : defns) {
this.defns.add(new RegexAutoTagScanner(def));
}
fireTableDataChanged();
}
use of org.zaproxy.zap.extension.pscan.scanner.RegexAutoTagScanner in project zaproxy by zaproxy.
the class PassiveScanParam method setAutoTagScanners.
public void setAutoTagScanners(List<RegexAutoTagScanner> scanners) {
this.autoTagScanners = scanners;
((HierarchicalConfiguration) getConfig()).clearTree(ALL_AUTO_TAG_SCANNERS_KEY);
for (int i = 0, size = scanners.size(); i < size; ++i) {
String elementBaseKey = ALL_AUTO_TAG_SCANNERS_KEY + "(" + i + ").";
RegexAutoTagScanner scanner = scanners.get(i);
getConfig().setProperty(elementBaseKey + AUTO_TAG_SCANNER_NAME_KEY, scanner.getName());
getConfig().setProperty(elementBaseKey + AUTO_TAG_SCANNER_TYPE_KEY, scanner.getType().toString());
getConfig().setProperty(elementBaseKey + AUTO_TAG_SCANNER_CONFIG_KEY, scanner.getConf());
getConfig().setProperty(elementBaseKey + AUTO_TAG_SCANNER_REQ_URL_REGEX_KEY, scanner.getRequestUrlRegex());
getConfig().setProperty(elementBaseKey + AUTO_TAG_SCANNER_REQ_HEAD_REGEX_KEY, scanner.getRequestHeaderRegex());
getConfig().setProperty(elementBaseKey + AUTO_TAG_SCANNER_RES_HEAD_REGEX_KEY, scanner.getResponseHeaderRegex());
getConfig().setProperty(elementBaseKey + AUTO_TAG_SCANNER_RES_BODY_REGEX_KEY, scanner.getResponseBodyRegex());
getConfig().setProperty(elementBaseKey + AUTO_TAG_SCANNER_ENABLED_KEY, Boolean.valueOf(scanner.isEnabled()));
}
}
use of org.zaproxy.zap.extension.pscan.scanner.RegexAutoTagScanner in project zaproxy by zaproxy.
the class DialogAddAutoTagScanner method performAction.
@Override
protected void performAction() {
scanner = new RegexAutoTagScanner(getNameTextField().getText(), RegexAutoTagScanner.TYPE.TAG, getConfigurationTextField().getText());
scanner.setRequestHeaderRegex(getRequestHeaderRegexTextField().getText());
scanner.setRequestUrlRegex(getRequestUrlRegexTextField().getText());
scanner.setResponseHeaderRegex(getResponseHeaderRegexTextField().getText());
scanner.setResponseBodyRegex(getResponseBodyRegexTextField().getText());
scanner.setEnabled(getEnabledCheckBox().isSelected());
}
Aggregations