| 1 | package com.jsql.model.injection.strategy.blind.callable; | |
| 2 | ||
| 3 | import com.jsql.model.InjectionModel; | |
| 4 | import com.jsql.model.injection.strategy.blind.AbstractInjectionBit.BlindOperator; | |
| 5 | import com.jsql.model.injection.strategy.blind.InjectionTime; | |
| 6 | ||
| 7 | import java.time.LocalDateTime; | |
| 8 | import java.time.ZoneOffset; | |
| 9 | ||
| 10 | /** | |
| 11 | * Define a call HTTP to the server, require the associated url, character position and bit. | |
| 12 | * diffSeconds represents the response time of the current page | |
| 13 | */ | |
| 14 | public class CallableTime extends AbstractCallableBit<CallableTime> { | |
| 15 | | |
| 16 | /** | |
| 17 | * Current page loading time. | |
| 18 | */ | |
| 19 | private long diffSeconds; | |
| 20 | ||
| 21 | private final InjectionModel injectionModel; | |
| 22 | | |
| 23 | private final InjectionTime injectionTime; | |
| 24 | private final String metadataInjectionProcess; | |
| 25 | | |
| 26 | /** | |
| 27 | * Constructor for preparation and blind confirmation. | |
| 28 | */ | |
| 29 | public CallableTime( | |
| 30 | String sqlQuery, | |
| 31 | InjectionModel injectionModel, | |
| 32 | InjectionTime injectionTime, | |
| 33 | BlindOperator blindOperator, | |
| 34 | String metadataInjectionProcess | |
| 35 | ) { | |
| 36 | this.injectionModel = injectionModel; | |
| 37 | this.injectionTime = injectionTime; | |
| 38 | this.metadataInjectionProcess = metadataInjectionProcess; | |
| 39 | this.booleanUrl = this.injectionModel.getMediatorEngine().getEngine().instance().sqlTestTimeWithOperator(sqlQuery, blindOperator); | |
| 40 | } | |
| 41 | | |
| 42 | /** | |
| 43 | * Constructor for bit test. | |
| 44 | */ | |
| 45 | public CallableTime( | |
| 46 | String sqlQuery, | |
| 47 | int indexChar, | |
| 48 | int bit, | |
| 49 | InjectionModel injectionModel, | |
| 50 | InjectionTime injectionTime, | |
| 51 | BlindOperator blindOperator, | |
| 52 | String metadataInjectionProcess | |
| 53 | ) { | |
| 54 | this(sqlQuery, injectionModel, injectionTime, blindOperator, metadataInjectionProcess); | |
| 55 | this.booleanUrl = this.injectionModel.getMediatorEngine().getEngine().instance().sqlTimeBit(sqlQuery, indexChar, bit, blindOperator); | |
| 56 | this.currentIndex = indexChar; | |
| 57 | this.currentBit = bit; | |
| 58 | } | |
| 59 | | |
| 60 | @Override | |
| 61 | public boolean isTrue() { | |
| 62 |
3
1. isTrue : changed conditional boundary → NO_COVERAGE 2. isTrue : replaced boolean return with true for com/jsql/model/injection/strategy/blind/callable/CallableTime::isTrue → NO_COVERAGE 3. isTrue : negated conditional → NO_COVERAGE |
return this.diffSeconds < this.injectionTime.getSleepTime(); |
| 63 | } | |
| 64 | ||
| 65 | /** | |
| 66 | * Process the URL HTTP call, use function inject() from the model. | |
| 67 | * Calculate the response time of the current page. | |
| 68 | * @return Functional Time callable | |
| 69 | */ | |
| 70 | @Override | |
| 71 | public CallableTime call() { | |
| 72 | var timeInMillisOnStart = LocalDateTime.now(ZoneOffset.UTC).toEpochSecond(ZoneOffset.UTC); | |
| 73 | this.injectionTime.callUrl(this.booleanUrl, this.metadataInjectionProcess, this); | |
| 74 | var timeInMillisOnEnd = LocalDateTime.now(ZoneOffset.UTC).toEpochSecond(ZoneOffset.UTC); | |
| 75 |
1
1. call : Replaced long subtraction with addition → NO_COVERAGE |
this.diffSeconds = timeInMillisOnEnd - timeInMillisOnStart; |
| 76 |
1
1. call : replaced return value with null for com/jsql/model/injection/strategy/blind/callable/CallableTime::call → NO_COVERAGE |
return this; |
| 77 | } | |
| 78 | } | |
Mutations | ||
| 62 |
1.1 2.2 3.3 |
|
| 75 |
1.1 |
|
| 76 |
1.1 |