| 1 | package com.jsql.model.suspendable; | |
| 2 | ||
| 3 | import com.jsql.model.InjectionModel; | |
| 4 | import com.jsql.model.exception.JSqlException; | |
| 5 | import com.jsql.view.subscriber.Seal; | |
| 6 | import com.jsql.model.exception.JSqlRuntimeException; | |
| 7 | import com.jsql.model.exception.StoppedByUserSlidingException; | |
| 8 | import com.jsql.model.injection.strategy.blind.AbstractInjectionBit; | |
| 9 | import com.jsql.model.injection.strategy.blind.InjectionEngine; | |
| 10 | import com.jsql.util.LogLevelUtil; | |
| 11 | import org.apache.commons.lang3.StringUtils; | |
| 12 | import org.apache.logging.log4j.LogManager; | |
| 13 | import org.apache.logging.log4j.Logger; | |
| 14 | ||
| 15 | import java.util.concurrent.atomic.AtomicBoolean; | |
| 16 | ||
| 17 | public class SuspendableGetEngine extends AbstractSuspendable { | |
| 18 | ||
| 19 | private static final Logger LOGGER = LogManager.getRootLogger(); | |
| 20 | ||
| 21 | public SuspendableGetEngine(InjectionModel injectionModel) { | |
| 22 | super(injectionModel); | |
| 23 | } | |
| 24 | ||
| 25 | @Override | |
| 26 | public String run(Input input) throws JSqlException { | |
| 27 | LOGGER.log(LogLevelUtil.CONSOLE_DEFAULT, "Fingerprinting database with Boolean match..."); | |
| 28 | ||
| 29 | AtomicBoolean isEngineFound = new AtomicBoolean(false); | |
| 30 | this.injectionModel.getMediatorEngine().getEnginesForFingerprint() | |
| 31 | .stream() | |
| 32 |
2
1. lambda$run$0 : negated conditional → NO_COVERAGE 2. lambda$run$0 : replaced boolean return with true for com/jsql/model/suspendable/SuspendableGetEngine::lambda$run$0 → NO_COVERAGE |
.filter(engine -> engine != this.injectionModel.getMediatorEngine().getAuto()) |
| 33 |
2
1. lambda$run$1 : replaced boolean return with true for com/jsql/model/suspendable/SuspendableGetEngine::lambda$run$1 → NO_COVERAGE 2. lambda$run$1 : replaced boolean return with false for com/jsql/model/suspendable/SuspendableGetEngine::lambda$run$1 → NO_COVERAGE |
.filter(engine -> StringUtils.isNotEmpty( |
| 34 | engine.instance().getModelYaml().getStrategy().getConfiguration().getFingerprint().getEngineSpecific() | |
| 35 | )) | |
| 36 |
1
1. run : removed call to java/util/stream/Stream::forEach → NO_COVERAGE |
.forEach(engine -> { |
| 37 |
1
1. lambda$run$2 : negated conditional → NO_COVERAGE |
if (isEngineFound.get()) { |
| 38 | return; | |
| 39 | } | |
| 40 | String engineSpecificWithOperator = this.injectionModel.getMediatorEngine().getEngine().instance().sqlTestBlindWithOperator( | |
| 41 | engine.instance().getModelYaml().getStrategy().getConfiguration().getFingerprint().getEngineSpecific(), | |
| 42 | AbstractInjectionBit.BlindOperator.OR // TODO should also test AND and no mode | |
| 43 | ); | |
| 44 | try { | |
| 45 | var injectionCharInsertion = new InjectionEngine(this.injectionModel, engineSpecificWithOperator, engine); | |
| 46 |
1
1. lambda$run$2 : negated conditional → NO_COVERAGE |
if (injectionCharInsertion.isInjectable(engineSpecificWithOperator)) { |
| 47 |
1
1. lambda$run$2 : negated conditional → NO_COVERAGE |
if (this.isSuspended()) { |
| 48 | throw new StoppedByUserSlidingException(); | |
| 49 | } | |
| 50 | ||
| 51 | LOGGER.log(LogLevelUtil.CONSOLE_SUCCESS, "Found [{}] using Boolean match", engine); | |
| 52 |
1
1. lambda$run$2 : removed call to com/jsql/model/injection/engine/MediatorEngine::setEngine → NO_COVERAGE |
this.injectionModel.getMediatorEngine().setEngine(engine); |
| 53 |
1
1. lambda$run$2 : removed call to java/util/concurrent/atomic/AtomicBoolean::set → NO_COVERAGE |
isEngineFound.set(true); |
| 54 | ||
| 55 |
1
1. lambda$run$2 : removed call to com/jsql/model/InjectionModel::sendToViews → NO_COVERAGE |
this.injectionModel.sendToViews(new Seal.ActivateEngine(this.injectionModel.getMediatorEngine().getEngine())); |
| 56 | } | |
| 57 | } catch (StoppedByUserSlidingException e) { | |
| 58 | throw new JSqlRuntimeException(e); | |
| 59 | } | |
| 60 | }); | |
| 61 |
1
1. run : replaced return value with "" for com/jsql/model/suspendable/SuspendableGetEngine::run → NO_COVERAGE |
return null; // unused |
| 62 | } | |
| 63 | } | |
Mutations | ||
| 32 |
1.1 2.2 |
|
| 33 |
1.1 2.2 |
|
| 36 |
1.1 |
|
| 37 |
1.1 |
|
| 46 |
1.1 |
|
| 47 |
1.1 |
|
| 52 |
1.1 |
|
| 53 |
1.1 |
|
| 55 |
1.1 |
|
| 61 |
1.1 |