| 1 | /******************************************************************************* | |
| 2 | * Copyhacked (H) 2012-2025. | |
| 3 | * This program and the accompanying materials | |
| 4 | * are made available under no term at all, use it like | |
| 5 | * you want, but share and discuss it | |
| 6 | * every time possible with every body. | |
| 7 | * | |
| 8 | * Contributors: | |
| 9 | * ron190 at ymail dot com - initial implementation | |
| 10 | ******************************************************************************/ | |
| 11 | package com.jsql.view.terminal.interaction; | |
| 12 | ||
| 13 | import com.jsql.model.InjectionModel; | |
| 14 | import com.jsql.model.bean.util.Header; | |
| 15 | import com.jsql.util.AnsiColorUtil; | |
| 16 | import com.jsql.view.interaction.InteractionCommand; | |
| 17 | import org.apache.logging.log4j.LogManager; | |
| 18 | import org.apache.logging.log4j.Logger; | |
| 19 | ||
| 20 | import java.util.Map; | |
| 21 | ||
| 22 | /** | |
| 23 | * Mark the injection as vulnerable to an error-based injection. | |
| 24 | */ | |
| 25 | public class MarkErrorVulnerable implements InteractionCommand { | |
| 26 | | |
| 27 | private static final Logger LOGGER = LogManager.getRootLogger(); | |
| 28 | | |
| 29 | private final int indexMethodError; | |
| 30 | private final InjectionModel injectionModel; | |
| 31 | | |
| 32 | @SuppressWarnings("unchecked") | |
| 33 | public MarkErrorVulnerable(Object[] interactionParams) { | |
| 34 | Map<Header, Object> mapHeader = (Map<Header, Object>) interactionParams[0]; | |
| 35 | this.indexMethodError = (int) mapHeader.get(Header.INDEX_ERROR_STRATEGY); | |
| 36 | this.injectionModel = (InjectionModel) mapHeader.get(Header.INJECTION_MODEL); | |
| 37 | } | |
| 38 | ||
| 39 | @Override | |
| 40 | public void execute() { | |
| 41 | LOGGER.info( | |
| 42 |
1
1. lambda$execute$0 : replaced return value with null for com/jsql/view/terminal/interaction/MarkErrorVulnerable::lambda$execute$0 → NO_COVERAGE |
() -> AnsiColorUtil.addGreenColor( |
| 43 | this.injectionModel | |
| 44 | .getMediatorVendor() | |
| 45 | .getVendor() | |
| 46 | .instance() | |
| 47 | .getModelYaml() | |
| 48 | .getStrategy() | |
| 49 | .getError() | |
| 50 | .getMethod() | |
| 51 | .get(this.indexMethodError) | |
| 52 | .getName() | |
| 53 | ) | |
| 54 | ); | |
| 55 | } | |
| 56 | } | |
Mutations | ||
| 42 |
1.1 |