use of com.jsql.model.injection.vendor.model.yaml.Method in project jsql-injection by ron190.
the class StrategyInjectionError method checkApplicability.
@Override
public void checkApplicability() {
// Reset applicability of new Vendor
this.isApplicable = false;
var strategyYaml = this.injectionModel.getMediatorVendor().getVendor().instance().getModelYaml().getStrategy();
if (strategyYaml.getError().getMethod().isEmpty()) {
LOGGER.log(LogLevel.CONSOLE_DEFAULT, "No Error strategy for {}", this.injectionModel.getMediatorVendor().getVendor());
return;
}
var configurationYaml = strategyYaml.getConfiguration();
LOGGER.log(LogLevel.CONSOLE_DEFAULT, "{} Error...", () -> I18nUtil.valueByKey("LOG_CHECKING_STRATEGY"));
this.tabCapacityMethod = new String[strategyYaml.getError().getMethod().size()];
var indexErrorMethod = 0;
var errorCapacity = 0;
for (Method errorMethod : strategyYaml.getError().getMethod()) {
boolean methodIsApplicable = this.isApplicable(configurationYaml, errorMethod);
if (methodIsApplicable) {
Matcher regexSearch = this.getPerformance(configurationYaml, errorMethod);
if (regexSearch.find()) {
errorCapacity = this.getCapacity(indexErrorMethod, errorCapacity, errorMethod, regexSearch);
} else {
LOGGER.log(LogLevel.CONSOLE_ERROR, "{} {} but injectable size is incorrect", () -> I18nUtil.valueByKey("LOG_VULNERABLE"), errorMethod::getName);
methodIsApplicable = false;
}
}
if (methodIsApplicable) {
this.allow(indexErrorMethod);
} else {
this.unallow(indexErrorMethod);
}
indexErrorMethod++;
}
}
use of com.jsql.model.injection.vendor.model.yaml.Method in project jsql-injection by ron190.
the class AddressMenuBar method initErrorMethods.
public void initErrorMethods(Vendor vendor) {
this.itemRadioStrategyError.removeAll();
var indexError = 0;
if (vendor != MediatorHelper.model().getMediatorVendor().getAuto() && vendor.instance().getModelYaml().getStrategy().getError() != null) {
for (Method methodError : vendor.instance().getModelYaml().getStrategy().getError().getMethod()) {
JMenuItem itemRadioVendor = new JRadioButtonMenuItem(methodError.getName());
itemRadioVendor.setEnabled(false);
itemRadioVendor.setName("itemRadioVendor" + methodError.getName());
this.itemRadioStrategyError.add(itemRadioVendor);
this.groupStrategy.add(itemRadioVendor);
int indexErrorFinal = indexError;
itemRadioVendor.addActionListener(actionEvent -> {
this.menuStrategy.setText(methodError.getName());
MediatorHelper.model().getMediatorStrategy().setStrategy(MediatorHelper.model().getMediatorStrategy().getError());
MediatorHelper.model().getMediatorStrategy().getError().setIndexErrorStrategy(indexErrorFinal);
});
indexError++;
}
}
}
use of com.jsql.model.injection.vendor.model.yaml.Method in project jsql-injection by ron190.
the class SqlEngine method populateTabError.
/**
* Dynamically add textPanes to Error tab for current vendor.
*/
private static void populateTabError() {
SqlEngine.tabbedPaneError.removeAll();
if (SqlEngine.modelYaml.getStrategy().getError() == null) {
return;
}
for (Method methodError : SqlEngine.modelYaml.getStrategy().getError().getMethod()) {
var panelError = new JPanel(new BorderLayout());
final var refMethodError = new Method[] { methodError };
var textPaneError = new JTextPaneLexer(refMethodError[0]::setQuery, refMethodError[0]::getQuery);
SqlEngine.resetLexer(textPaneError);
textPaneError.switchSetterToVendor();
textPaneError.setText(methodError.getQuery().trim());
textPaneError.setBorder(SqlEngine.borderRight);
panelError.add(new LightScrollPane(1, 0, 1, 0, textPaneError), BorderLayout.CENTER);
var panelLimit = new JPanel();
panelLimit.setLayout(new BoxLayout(panelLimit, BoxLayout.LINE_AXIS));
panelLimit.add(new JLabel(" Overflow limit: "));
panelLimit.add(new JTextField(Integer.toString(methodError.getCapacity())));
// TODO Integrate Error limit
panelError.add(panelLimit, BorderLayout.SOUTH);
SqlEngine.tabbedPaneError.addTab(methodError.getName(), panelError);
SqlEngine.tabbedPaneError.setTitleAt(SqlEngine.tabbedPaneError.getTabCount() - 1, String.format("<html><div style=\"text-align:left;width:100px;\">%s</div></html>", methodError.getName()));
SqlEngine.textPanesError.add(textPaneError);
}
}
Aggregations