InjectionModel.java

1
/*******************************************************************************
2
 * Copyhacked (H) 2012-2020.
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 about it
6
 * every time possible with every body.
7
 * 
8
 * Contributors:
9
 *      ron190 at ymail dot com - initial implementation
10
 ******************************************************************************/
11
package com.jsql.model;
12
13
import com.jsql.model.accessible.DataAccess;
14
import com.jsql.model.accessible.ResourceAccess;
15
import com.jsql.model.bean.util.Header;
16
import com.jsql.model.bean.util.Interaction;
17
import com.jsql.model.bean.util.Request;
18
import com.jsql.model.exception.JSqlException;
19
import com.jsql.model.exception.JSqlRuntimeException;
20
import com.jsql.model.injection.method.AbstractMethodInjection;
21
import com.jsql.model.injection.method.MediatorMethod;
22
import com.jsql.model.injection.strategy.MediatorStrategy;
23
import com.jsql.model.injection.strategy.blind.AbstractCallableBoolean;
24
import com.jsql.model.injection.vendor.MediatorVendor;
25
import com.jsql.model.injection.vendor.model.VendorYaml;
26
import com.jsql.util.*;
27
import com.jsql.util.GitUtil.ShowOnConsole;
28
import org.apache.commons.lang3.StringUtils;
29
import org.apache.commons.lang3.SystemUtils;
30
import org.apache.logging.log4j.LogManager;
31
import org.apache.logging.log4j.Logger;
32
33
import java.io.IOException;
34
import java.io.Serializable;
35
import java.net.*;
36
import java.net.http.HttpRequest;
37
import java.net.http.HttpRequest.BodyPublishers;
38
import java.net.http.HttpRequest.Builder;
39
import java.net.http.HttpResponse;
40
import java.net.http.HttpResponse.BodyHandlers;
41
import java.nio.charset.StandardCharsets;
42
import java.text.DecimalFormat;
43
import java.time.Duration;
44
import java.util.AbstractMap.SimpleEntry;
45
import java.util.EnumMap;
46
import java.util.Map;
47
import java.util.regex.Matcher;
48
import java.util.stream.Collectors;
49
import java.util.stream.Stream;
50
51
/**
52
 * Model class of MVC pattern for processing SQL injection automatically.<br>
53
 * Different views can be attached to this observable, like Swing or command line, in order to separate
54
 * the functional job from the graphical processing.<br>
55
 * The Model has a specific database vendor and strategy which run an automatic injection to get name of
56
 * databases, tables, columns and values, and it can also retrieve resources like files and shell.<br>
57
 * Tasks are run in multi-threads in general to speed the process.
58
 */
59
public class InjectionModel extends AbstractModelObservable implements Serializable {
60
    
61
    /**
62
     * Log4j logger sent to view.
63
     */
64
    private static final Logger LOGGER = LogManager.getRootLogger();
65
    
66
    private final transient MediatorVendor mediatorVendor = new MediatorVendor(this);
67
    private final transient MediatorMethod mediatorMethod = new MediatorMethod(this);
68
    private final transient MediatorUtils mediatorUtils;
69
    private final transient MediatorStrategy mediatorStrategy;
70
71
    private final transient PropertiesUtil propertiesUtil = new PropertiesUtil();
72
             
73
    private final transient DataAccess dataAccess = new DataAccess(this);
74
    private final transient ResourceAccess resourceAccess = new ResourceAccess(this);
75
    
76
    public static final String STAR = "*";
77
    
78
    /**
79
     * initialUrl transformed to a correct injection url.
80
     */
81
    private String indexesInUrl = StringUtils.EMPTY;
82
    private String analysisReport = StringUtils.EMPTY;
83
84
    /**
85
     * Allow to directly start an injection after a failed one
86
     * without asking the user 'Start a new injection?'.
87
     */
88
    private boolean shouldErasePreviousInjection = false;
89
90
    private boolean isScanning = false;
91
92
    public InjectionModel() {
93
        
94
        this.mediatorUtils = new MediatorUtils();
95
        
96
        this.mediatorStrategy = new MediatorStrategy(this);
97
98 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setCertificateUtil → SURVIVED
        this.mediatorUtils.setCertificateUtil(new CertificateUtil());
99 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setPropertiesUtil → KILLED
        this.mediatorUtils.setPropertiesUtil(this.propertiesUtil);
100 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setConnectionUtil → KILLED
        this.mediatorUtils.setConnectionUtil(new ConnectionUtil(this));
101 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setAuthenticationUtil → SURVIVED
        this.mediatorUtils.setAuthenticationUtil(new AuthenticationUtil());
102 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setGitUtil → SURVIVED
        this.mediatorUtils.setGitUtil(new GitUtil(this));
103 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setHeaderUtil → SURVIVED
        this.mediatorUtils.setHeaderUtil(new HeaderUtil(this));
104 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setParameterUtil → KILLED
        this.mediatorUtils.setParameterUtil(new ParameterUtil(this));
105 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setExceptionUtil → SURVIVED
        this.mediatorUtils.setExceptionUtil(new ExceptionUtil(this));
106 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setSoapUtil → SURVIVED
        this.mediatorUtils.setSoapUtil(new SoapUtil(this));
107 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setMultipartUtil → SURVIVED
        this.mediatorUtils.setMultipartUtil(new MultipartUtil(this));
108 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setCookiesUtil → SURVIVED
        this.mediatorUtils.setCookiesUtil(new CookiesUtil(this));
109 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setJsonUtil → SURVIVED
        this.mediatorUtils.setJsonUtil(new JsonUtil(this));
110 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setPreferencesUtil → KILLED
        this.mediatorUtils.setPreferencesUtil(new PreferencesUtil());
111 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setProxyUtil → SURVIVED
        this.mediatorUtils.setProxyUtil(new ProxyUtil(this));
112 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setThreadUtil → SURVIVED
        this.mediatorUtils.setThreadUtil(new ThreadUtil(this));
113 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setTamperingUtil → SURVIVED
        this.mediatorUtils.setTamperingUtil(new TamperingUtil());
114 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setUserAgentUtil → SURVIVED
        this.mediatorUtils.setUserAgentUtil(new UserAgentUtil());
115 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setCsrfUtil → SURVIVED
        this.mediatorUtils.setCsrfUtil(new CsrfUtil(this));
116 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setFormUtil → SURVIVED
        this.mediatorUtils.setFormUtil(new FormUtil(this));
117 1 1. <init> : removed call to com/jsql/model/MediatorUtils::setDigestUtil → SURVIVED
        this.mediatorUtils.setDigestUtil(new DigestUtil(this));
118
    }
119
120
    /**
121
     * Reset each injection attributes: Database metadata, General Thread status, Strategy.
122
     */
123
    public void resetModel() {
124
        
125 1 1. resetModel : removed call to com/jsql/model/injection/strategy/StrategyInjectionNormal::setVisibleIndex → NO_COVERAGE
        this.mediatorStrategy.getSpecificNormal().setVisibleIndex(null);
126
        
127 1 1. resetModel : removed call to com/jsql/model/injection/strategy/AbstractStrategy::setApplicable → NO_COVERAGE
        this.mediatorStrategy.getNormal().setApplicable(false);
128 1 1. resetModel : removed call to com/jsql/model/injection/strategy/StrategyInjectionError::setApplicable → NO_COVERAGE
        this.mediatorStrategy.getError().setApplicable(false);
129 1 1. resetModel : removed call to com/jsql/model/injection/strategy/AbstractStrategy::setApplicable → NO_COVERAGE
        this.mediatorStrategy.getBlind().setApplicable(false);
130 1 1. resetModel : removed call to com/jsql/model/injection/strategy/AbstractStrategy::setApplicable → NO_COVERAGE
        this.mediatorStrategy.getMultibit().setApplicable(false);
131 1 1. resetModel : removed call to com/jsql/model/injection/strategy/AbstractStrategy::setApplicable → NO_COVERAGE
        this.mediatorStrategy.getTime().setApplicable(false);
132 1 1. resetModel : removed call to com/jsql/model/injection/strategy/AbstractStrategy::setApplicable → NO_COVERAGE
        this.mediatorStrategy.getStacked().setApplicable(false);
133 1 1. resetModel : removed call to com/jsql/model/injection/strategy/MediatorStrategy::setStrategy → NO_COVERAGE
        this.mediatorStrategy.setStrategy(null);
134
135
        this.indexesInUrl = StringUtils.EMPTY;
136
        this.analysisReport = StringUtils.EMPTY;
137
        this.isStoppedByUser = false;
138
        this.shouldErasePreviousInjection = false;
139
140 1 1. resetModel : removed call to com/jsql/util/CsrfUtil::setTokenCsrf → NO_COVERAGE
        this.mediatorUtils.getCsrfUtil().setTokenCsrf(null);
141 1 1. resetModel : removed call to com/jsql/util/DigestUtil::setTokenDigest → NO_COVERAGE
        this.mediatorUtils.getDigestUtil().setTokenDigest(null);
142 1 1. resetModel : removed call to com/jsql/util/ThreadUtil::reset → NO_COVERAGE
        this.mediatorUtils.getThreadUtil().reset();
143
    }
144
145
    /**
146
     * Prepare the injection process, can be interrupted by the user (via shouldStopAll).
147
     * Erase all attributes eventually defined in a previous injection.
148
     * Run by Scan, Standard and TU.
149
     */
150
    public void beginInjection() {
151
        
152 1 1. beginInjection : removed call to com/jsql/model/InjectionModel::resetModel → NO_COVERAGE
        this.resetModel();
153
        
154
        try {
155 1 1. beginInjection : negated conditional → NO_COVERAGE
            if (this.mediatorUtils.getProxyUtil().isNotLive(ShowOnConsole.YES)) {
156
                return;
157
            }
158
            
159
            LOGGER.log(
160
                LogLevelUtil.CONSOLE_INFORM,
161
                "{}: {}",
162 1 1. lambda$beginInjection$0 : replaced return value with null for com/jsql/model/InjectionModel::lambda$beginInjection$0 → NO_COVERAGE
                () -> I18nUtil.valueByKey("LOG_START_INJECTION"),
163 1 1. lambda$beginInjection$1 : replaced return value with null for com/jsql/model/InjectionModel::lambda$beginInjection$1 → NO_COVERAGE
                () -> this.mediatorUtils.getConnectionUtil().getUrlByUser()
164
            );
165
            
166
            // Check general integrity if user's parameters
167 1 1. beginInjection : removed call to com/jsql/util/ParameterUtil::checkParametersFormat → NO_COVERAGE
            this.mediatorUtils.getParameterUtil().checkParametersFormat();
168
            
169 1 1. beginInjection : removed call to com/jsql/util/ConnectionUtil::testConnection → NO_COVERAGE
            this.mediatorUtils.getConnectionUtil().testConnection();
170
171
            // TODO Check all path params
172
            boolean hasFoundInjection = this.mediatorMethod.getQuery().testParameters(false);
173
            hasFoundInjection = this.mediatorUtils.getMultipartUtil().testParameters(hasFoundInjection);
174
            hasFoundInjection = this.mediatorUtils.getSoapUtil().testParameters(hasFoundInjection);
175
            hasFoundInjection = this.mediatorMethod.getRequest().testParameters(hasFoundInjection);
176
            hasFoundInjection = this.mediatorMethod.getHeader().testParameters(hasFoundInjection);
177
            hasFoundInjection = this.mediatorUtils.getCookiesUtil().testParameters(hasFoundInjection);
178
179 2 1. beginInjection : negated conditional → NO_COVERAGE
2. beginInjection : negated conditional → NO_COVERAGE
            if (hasFoundInjection && !this.isScanning) {
180
181 1 1. beginInjection : negated conditional → NO_COVERAGE
                if (!this.getMediatorUtils().getPreferencesUtil().isNotShowingVulnReport()) {
182
183
                    var requestSetVendor = new Request();
184 1 1. beginInjection : removed call to com/jsql/model/bean/util/Request::setMessage → NO_COVERAGE
                    requestSetVendor.setMessage(Interaction.CREATE_ANALYSIS_REPORT);
185 1 1. beginInjection : removed call to com/jsql/model/bean/util/Request::setParameters → NO_COVERAGE
                    requestSetVendor.setParameters(this.analysisReport);
186 1 1. beginInjection : removed call to com/jsql/model/InjectionModel::sendToViews → NO_COVERAGE
                    this.sendToViews(requestSetVendor);
187
                }
188
189 1 1. beginInjection : negated conditional → NO_COVERAGE
                if (this.getMediatorUtils().getPreferencesUtil().isZipStrategy()) {
190
                    LOGGER.log(LogLevelUtil.CONSOLE_INFORM, "Using Zip mode for reduced query size");
191 1 1. beginInjection : negated conditional → NO_COVERAGE
                } else if (this.getMediatorUtils().getPreferencesUtil().isDiosStrategy()) {
192
                    LOGGER.log(LogLevelUtil.CONSOLE_INFORM, "Using Dump In One Shot strategy for single query dump");
193
                }
194
                
195 1 1. beginInjection : negated conditional → NO_COVERAGE
                if (!this.mediatorUtils.getPreferencesUtil().isNotInjectingMetadata()) {
196 1 1. beginInjection : removed call to com/jsql/model/accessible/DataAccess::getDatabaseInfos → NO_COVERAGE
                    this.dataAccess.getDatabaseInfos();
197
                }
198
                
199
                this.dataAccess.listDatabases();
200
            }
201
            
202
            LOGGER.log(LogLevelUtil.CONSOLE_DEFAULT, () -> I18nUtil.valueByKey("LOG_DONE"));
203
            
204
            this.shouldErasePreviousInjection = true;
205
            
206
        } catch (InterruptedException e) {
207
            
208
            LOGGER.log(LogLevelUtil.IGNORE, e, e);
209 1 1. beginInjection : removed call to java/lang/Thread::interrupt → NO_COVERAGE
            Thread.currentThread().interrupt();
210
            
211
        } catch (JSqlRuntimeException | JSqlException | IOException e) {  // Catch expected exceptions only
212
213 1 1. beginInjection : negated conditional → NO_COVERAGE
            if (e.getMessage() == null) {
214
                LOGGER.log(LogLevelUtil.CONSOLE_ERROR, "Unexpected: {}", getImplicitReason(e));
215
            } else {
216
                LOGGER.log(LogLevelUtil.CONSOLE_ERROR, "Unexpected: {}", e.getMessage());
217
            }
218
219 1 1. beginInjection : negated conditional → NO_COVERAGE
            if (e.toString().contains("HTTP/1.1")) {
220
                LOGGER.log(LogLevelUtil.CONSOLE_ERROR, "Something went wrong with HTTP/2, try to switch manually to HTTP/1.1 in preferences");
221
            }
222
        } finally {
223
            
224
            var request = new Request();
225 1 1. beginInjection : removed call to com/jsql/model/bean/util/Request::setMessage → NO_COVERAGE
            request.setMessage(Interaction.END_PREPARATION);
226 1 1. beginInjection : removed call to com/jsql/model/InjectionModel::sendToViews → NO_COVERAGE
            this.sendToViews(request);
227
        }
228
    }
229
    
230
    public static String getImplicitReason(Throwable e) {
231
        
232
        String eMessage = e.getClass().getSimpleName();
233
        
234 1 1. getImplicitReason : negated conditional → NO_COVERAGE
        if (e.getMessage() != null) {
235
            eMessage += ": "+ e.getMessage();
236
        }
237
        
238 2 1. getImplicitReason : negated conditional → NO_COVERAGE
2. getImplicitReason : negated conditional → NO_COVERAGE
        if (e.getCause() != null && !e.equals(e.getCause())) {
239
            eMessage += " > "+ getImplicitReason(e.getCause());
240
        }
241
        
242 1 1. getImplicitReason : replaced return value with "" for com/jsql/model/InjectionModel::getImplicitReason → NO_COVERAGE
        return eMessage;
243
    }
244
    
245
    /**
246
     * Run a HTTP connection to the web server.
247
     * @param dataInjection SQL query
248
     * @return source code of current page
249
     */
250
    @Override
251
    public String inject(
252
        String dataInjection,
253
        boolean isUsingIndex,
254
        String metadataInjectionProcess,
255
        AbstractCallableBoolean<?> callableBoolean,
256
        boolean isReport
257
    ) {
258
        
259
        // Temporary url, we go from "select 1,2,3,4..." to "select 1,([complex query]),2...", but keep initial url
260
        String urlInjection = this.mediatorUtils.getConnectionUtil().getUrlBase();
261
262
        urlInjection = this.mediatorStrategy.buildPath(urlInjection, isUsingIndex, dataInjection);
263
        
264
        urlInjection = StringUtil.cleanSql(urlInjection.trim());
265
266
        URL urlObject;
267
        
268
        // TODO Keep only a single check
269
        try {
270
            urlObject = new URI(urlInjection).toURL();
271
        } catch (MalformedURLException | URISyntaxException e) {
272
            
273
            LOGGER.log(
274
                LogLevelUtil.CONSOLE_ERROR,
275
                String.format("Incorrect Query Url: %s", e.getMessage())
276
            );
277
            return StringUtils.EMPTY;
278
        }
279
280
        Map<Header, Object> msgHeader = new EnumMap<>(Header.class);
281
282
        // TODO identique urlInjection == urlObject
283
        urlObject = this.initializeQueryString(
284
            isUsingIndex,
285
            urlInjection,
286
            dataInjection,
287
            urlObject,
288
            msgHeader
289
        );
290
        
291
        String pageSource = StringUtils.EMPTY;
292
        
293
        // Define the connection
294
        try {
295
            var httpRequestBuilder = HttpRequest.newBuilder()
296
                .uri(URI.create(urlObject.toString()))
297
                .setHeader(HeaderUtil.CONTENT_TYPE_REQUEST, "text/plain")
298
                .timeout(Duration.ofSeconds(15));
299
            
300 1 1. inject : removed call to com/jsql/util/CsrfUtil::addHeaderToken → NO_COVERAGE
            this.mediatorUtils.getCsrfUtil().addHeaderToken(httpRequestBuilder);
301 1 1. inject : removed call to com/jsql/util/DigestUtil::addHeaderToken → NO_COVERAGE
            this.mediatorUtils.getDigestUtil().addHeaderToken(httpRequestBuilder);
302
303 1 1. inject : removed call to com/jsql/util/ConnectionUtil::setCustomUserAgent → NO_COVERAGE
            this.mediatorUtils.getConnectionUtil().setCustomUserAgent(httpRequestBuilder);
304
305
            String body = this.initializeRequest(isUsingIndex, dataInjection, httpRequestBuilder, msgHeader);
306 1 1. inject : removed call to com/jsql/model/InjectionModel::initializeHeader → NO_COVERAGE
            this.initializeHeader(isUsingIndex, dataInjection, httpRequestBuilder);
307
            
308
            var httpRequest = httpRequestBuilder.build();
309
310 1 1. inject : negated conditional → NO_COVERAGE
            if (isReport) {
311
312
                String report = "<br><span style=color:rgb(75,143,211)>Method:</span> " + httpRequest.method();
313
                report += "<br><span style=color:rgb(75,143,211)>Path:</span> " + httpRequest.uri().getPath();
314 1 1. inject : negated conditional → NO_COVERAGE
                if (httpRequest.uri().getQuery() != null) {
315
                    report += "<br><span style=color:rgb(75,143,211)>Query:</span> " + httpRequest.uri().getQuery();
316
                }
317
318
                if (
319 1 1. inject : negated conditional → NO_COVERAGE
                    !(this.mediatorUtils.getParameterUtil().getListRequest().isEmpty()
320 1 1. inject : negated conditional → NO_COVERAGE
                    && this.mediatorUtils.getCsrfUtil().getTokenCsrf() == null)
321
                ) {
322
                    report += "<br><span style=color:rgb(75,143,211)>Body:</span> " + body;
323
                }
324
325
                report += "<br><span style=color:rgb(75,143,211)>Header:</span> " + httpRequest.headers().map().entrySet().stream()
326 1 1. lambda$inject$3 : replaced return value with "" for com/jsql/model/InjectionModel::lambda$inject$3 → NO_COVERAGE
                    .map(entry -> String.format("%s: %s", entry.getKey(), String.join("", entry.getValue())))
327
                    .collect(Collectors.joining("<br>"));
328 1 1. inject : replaced return value with "" for com/jsql/model/InjectionModel::inject → NO_COVERAGE
                return report;
329
            }
330
            
331
            HttpResponse<String> response = this.getMediatorUtils().getConnectionUtil().getHttpClient().send(
332
                httpRequestBuilder.build(),
333
                BodyHandlers.ofString()
334
            );
335
336 1 1. inject : negated conditional → NO_COVERAGE
            if (this.mediatorUtils.getParameterUtil().isRequestSoap()) {
337
                // Invalid XML control chars like \x04 requires urlencoding from server
338
                pageSource = URLDecoder.decode(response.body(), StandardCharsets.UTF_8);
339
            } else {
340
                pageSource = response.body();
341
            }
342
343
            Map<String, String> headersResponse = ConnectionUtil.getHeadersMap(response);
344
            
345
            msgHeader.put(Header.RESPONSE, headersResponse);
346
            msgHeader.put(Header.HEADER, ConnectionUtil.getHeadersMap(httpRequest.headers()));
347
            
348
            int sizeHeaders = headersResponse.keySet()
349
                .stream()
350 2 1. lambda$inject$4 : Replaced integer addition with subtraction → NO_COVERAGE
2. lambda$inject$4 : replaced Integer return value with 0 for com/jsql/model/InjectionModel::lambda$inject$4 → NO_COVERAGE
                .map(key -> headersResponse.get(key).length() + key.length())
351
                .mapToInt(Integer::intValue)
352
                .sum();
353
            
354 2 1. inject : Replaced float division with multiplication → NO_COVERAGE
2. inject : Replaced integer addition with subtraction → NO_COVERAGE
            float size = (float) (pageSource.length() + sizeHeaders) / 1024;
355
            var decimalFormat = new DecimalFormat("0.000");
356
            msgHeader.put(Header.PAGE_SIZE, decimalFormat.format(size));
357
            
358 1 1. inject : negated conditional → NO_COVERAGE
            if (this.mediatorUtils.getParameterUtil().isRequestSoap()) {
359
                pageSource = StringUtil.fromHtml(pageSource);
360
            }
361
            
362
            msgHeader.put(
363
                Header.SOURCE,
364
                pageSource
365
                .replaceAll("(#){60,}", "$1...")  // Remove ranges of # created by calibration
366
                .replaceAll("(jIyM){60,}", "$1...")  // Remove batch of chars created by Dios
367
            );
368
            msgHeader.put(Header.METADATA_PROCESS, metadataInjectionProcess);
369
            msgHeader.put(Header.METADATA_STRATEGY, this.mediatorStrategy.getMeta());
370
            msgHeader.put(Header.METADATA_BOOLEAN, callableBoolean);
371
            
372
            // Send data to Views
373
            var request = new Request();
374 1 1. inject : removed call to com/jsql/model/bean/util/Request::setMessage → NO_COVERAGE
            request.setMessage(Interaction.MESSAGE_HEADER);
375 1 1. inject : removed call to com/jsql/model/bean/util/Request::setParameters → NO_COVERAGE
            request.setParameters(msgHeader);
376 1 1. inject : removed call to com/jsql/model/InjectionModel::sendToViews → NO_COVERAGE
            this.sendToViews(request);
377
            
378
        } catch (IOException e) {
379
            LOGGER.log(
380
                LogLevelUtil.CONSOLE_ERROR,
381
                String.format("Error during connection: %s", e.getMessage())
382
            );
383
        } catch (InterruptedException e) {
384
            
385
            LOGGER.log(LogLevelUtil.IGNORE, e, e);
386 1 1. inject : removed call to java/lang/Thread::interrupt → NO_COVERAGE
            Thread.currentThread().interrupt();
387
        }
388
389
        // return the source code of the page
390 1 1. inject : replaced return value with "" for com/jsql/model/InjectionModel::inject → NO_COVERAGE
        return pageSource;
391
    }
392
393
    private URL initializeQueryString(
394
        boolean isUsingIndex,
395
        String urlInjection,
396
        String dataInjection,
397
        URL urlObject,
398
        Map<Header, Object> msgHeader
399
    ) {
400
        
401
        String urlInjectionFixed = urlInjection;
402
        var urlObjectFixed = urlObject;
403
        
404
        if (
405 1 1. initializeQueryString : negated conditional → NO_COVERAGE
            this.mediatorUtils.getParameterUtil().getListQueryString().isEmpty()
406 1 1. initializeQueryString : negated conditional → NO_COVERAGE
            && !this.mediatorUtils.getPreferencesUtil().isProcessingCsrf()
407
        ) {
408
409
            msgHeader.put(Header.URL, urlInjectionFixed);
410 1 1. initializeQueryString : replaced return value with null for com/jsql/model/InjectionModel::initializeQueryString → NO_COVERAGE
            return urlObjectFixed;
411
        }
412
            
413
        // URL without query string like Request and Header can receive
414
        // new params from <form> parsing, in that case add the '?' to URL
415 1 1. initializeQueryString : negated conditional → NO_COVERAGE
        if (!urlInjectionFixed.contains("?")) {
416
            urlInjectionFixed += "?";
417
        }
418
419
        urlInjectionFixed += this.buildQuery(
420
            this.mediatorMethod.getQuery(),
421
            this.mediatorUtils.getParameterUtil().getQueryStringFromEntries(),
422
            isUsingIndex,
423
            dataInjection
424
        );
425
426
        urlInjectionFixed = this.mediatorUtils.getCsrfUtil().addQueryStringToken(urlInjectionFixed);
427
        
428
        // TODO Keep single check
429
        try {
430
            urlObjectFixed = new URI(urlInjectionFixed).toURL();
431
        } catch (MalformedURLException | URISyntaxException e) {
432
            LOGGER.log(
433
                LogLevelUtil.CONSOLE_ERROR,
434
                String.format("Incorrect Url: %s", e.getMessage())
435
            );
436
        }
437
438
        msgHeader.put(Header.URL, urlInjectionFixed);
439
        
440 1 1. initializeQueryString : replaced return value with null for com/jsql/model/InjectionModel::initializeQueryString → NO_COVERAGE
        return urlObjectFixed;
441
    }
442
443
    private void initializeHeader(
444
        boolean isUsingIndex,
445
        String dataInjection,
446
        Builder httpRequest
447
    ) {
448 1 1. initializeHeader : negated conditional → NO_COVERAGE
        if (!this.mediatorUtils.getParameterUtil().getListHeader().isEmpty()) {
449
            Stream.of(
450
                this.buildQuery(
451
                    this.mediatorMethod.getHeader(),
452
                    this.mediatorUtils.getParameterUtil().getHeaderFromEntries(),
453
                    isUsingIndex,
454
                    dataInjection
455
                )
456
                .split("\\\\r\\\\n")
457
            )
458 1 1. initializeHeader : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
            .forEach(header -> {
459 1 1. lambda$initializeHeader$5 : negated conditional → NO_COVERAGE
                if (header.split(":").length == 2) {
460
                    try {  // TODO Should not catch, rethrow or use runtime exception
461 1 1. lambda$initializeHeader$5 : removed call to com/jsql/util/HeaderUtil::sanitizeHeaders → NO_COVERAGE
                        HeaderUtil.sanitizeHeaders(
462
                            httpRequest,
463
                            new SimpleEntry<>(
464
                                header.split(":")[0],
465
                                header.split(":")[1]
466
                            )
467
                        );
468
                    } catch (JSqlException e) {
469
                        LOGGER.log(LogLevelUtil.CONSOLE_ERROR, "Headers sanitizing issue caught already during connection, ignoring", e);
470
                    }
471
                }
472
            });
473
        }
474
    }
475
476
    private String initializeRequest(
477
        boolean isUsingIndex,
478
        String dataInjection,
479
        Builder httpRequest,
480
        Map<Header, Object> msgHeader
481
    ) {
482
        
483
        if (
484 1 1. initializeRequest : negated conditional → NO_COVERAGE
            this.mediatorUtils.getParameterUtil().getListRequest().isEmpty()
485 1 1. initializeRequest : negated conditional → NO_COVERAGE
            && this.mediatorUtils.getCsrfUtil().getTokenCsrf() == null
486
        ) {
487 1 1. initializeRequest : replaced return value with "" for com/jsql/model/InjectionModel::initializeRequest → NO_COVERAGE
            return dataInjection;
488
        }
489
            
490
        // Set connection method
491
        // Active for query string injection too, in that case inject query string still with altered method
492
        
493
        var body = new StringBuilder();
494
        
495 1 1. initializeRequest : negated conditional → NO_COVERAGE
        if (this.mediatorUtils.getParameterUtil().isRequestSoap()) {
496
            httpRequest.setHeader(HeaderUtil.CONTENT_TYPE_REQUEST, "text/xml");
497
        } else {
498
            httpRequest.setHeader(HeaderUtil.CONTENT_TYPE_REQUEST, "application/x-www-form-urlencoded");
499
        }
500
   
501 1 1. initializeRequest : removed call to com/jsql/util/CsrfUtil::addRequestToken → NO_COVERAGE
        this.mediatorUtils.getCsrfUtil().addRequestToken(body);
502
            
503 1 1. initializeRequest : negated conditional → NO_COVERAGE
        if (this.mediatorUtils.getConnectionUtil().getTypeRequest().matches("PUT|POST")) {
504 1 1. initializeRequest : negated conditional → NO_COVERAGE
            if (this.mediatorUtils.getParameterUtil().isRequestSoap()) {
505
                body.append(
506
                    this.buildQuery(
507
                        this.mediatorMethod.getRequest(),
508
                        this.mediatorUtils.getParameterUtil().getRawRequest(),
509
                        isUsingIndex,
510
                        dataInjection
511
                    )
512
                    // Invalid XML characters in recent Spring version
513
                    // Server needs to urldecode, or stop using out of range chars
514
                    .replace("\u0001", "&#01;")
515
                    .replace("\u0003", "&#03;")
516
                    .replace("\u0004", "&#04;")
517
                    .replace("\u0005", "&#05;")
518
                    .replace("\u0006", "&#06;")
519
                    .replace("\u0007", "&#07;")
520
                    .replace("+", "%2B")  // Prevent replace '+' into 'space' on server side urldecode
521
                );
522
            } else {
523
                body.append(
524
                    this.buildQuery(
525
                        this.mediatorMethod.getRequest(),
526
                        this.mediatorUtils.getParameterUtil().getRequestFromEntries(),
527
                        isUsingIndex,
528
                        dataInjection
529
                    )
530
                );
531
            }
532
        }
533
        
534
        var bodyPublisher = BodyPublishers.ofString(body.toString());
535
        
536
        httpRequest.method(
537
            this.mediatorUtils.getConnectionUtil().getTypeRequest(),
538
            bodyPublisher
539
        );
540
        
541
        msgHeader.put(Header.POST, body.toString());
542 1 1. initializeRequest : replaced return value with "" for com/jsql/model/InjectionModel::initializeRequest → NO_COVERAGE
        return body.toString();
543
    }
544
    
545
    private String buildQuery(AbstractMethodInjection methodInjection, String paramLead, boolean isUsingIndex, String sqlTrail) {
546
        
547
        String query;
548
        String paramLeadFixed = paramLead.replace(
549
            InjectionModel.STAR,
550
            TamperingUtil.TAG_OPENED + InjectionModel.STAR + TamperingUtil.TAG_CLOSED
551
        );
552
        
553
        if (
554
            // No parameter transformation if method is not selected by user
555 1 1. buildQuery : negated conditional → NO_COVERAGE
            this.mediatorUtils.getConnectionUtil().getMethodInjection() != methodInjection
556
            // No parameter transformation if injection point in URL
557 1 1. buildQuery : negated conditional → NO_COVERAGE
            || this.mediatorUtils.getConnectionUtil().getUrlBase().contains(InjectionModel.STAR)
558
        ) {
559
            // Just pass parameters without any transformation
560
            query = paramLeadFixed;
561
        } else if (
562
            // If method is selected by user and URL does not contain injection point
563
            // but parameters contain an injection point
564
            // then replace injection point by SQL expression in this parameter
565 1 1. buildQuery : negated conditional → NO_COVERAGE
            paramLeadFixed.contains(InjectionModel.STAR)
566
        ) {
567
            query = this.initializeStarInjection(paramLeadFixed, isUsingIndex, sqlTrail);
568
        } else {
569
            query = this.initializeRawInjection(paramLeadFixed, isUsingIndex, sqlTrail);
570
        }
571
        
572
        // Remove comments except empty /**/
573
        query = this.cleanQuery(methodInjection, query);
574
        
575
        // Add empty comments with space=>/**/
576 1 1. buildQuery : negated conditional → NO_COVERAGE
        if (this.mediatorUtils.getConnectionUtil().getMethodInjection() == methodInjection) {
577
            query = this.mediatorUtils.getTamperingUtil().tamper(query);
578
        }
579
        
580
        query = this.applyEncoding(methodInjection, query);
581
        
582 1 1. buildQuery : replaced return value with "" for com/jsql/model/InjectionModel::buildQuery → NO_COVERAGE
        return query;
583
    }
584
585
    private String initializeRawInjection(String paramLead, boolean isUsingIndex, String sqlTrail) {
586
        
587
        String query;
588
        
589
        // Method is selected by user and there's no injection point
590 1 1. initializeRawInjection : negated conditional → NO_COVERAGE
        if (!isUsingIndex) {
591
            // Several SQL expressions does not use indexes in SELECT,
592
            // like Boolean, Error, Shell and search for character insertion,
593
            // in that case concat SQL expression to the end of param.
594
            query = paramLead + sqlTrail;
595
        } else {
596
            // Concat indexes found for Normal strategy to params
597
            // and use visible Index for injection
598
            query = paramLead + this.indexesInUrl.replaceAll(
599
                String.format(VendorYaml.FORMAT_INDEX, this.mediatorStrategy.getSpecificNormal().getVisibleIndex()),
600
                // Oracle column often contains $, which is reserved for regex.
601
                // => need to be escape with quoteReplacement()
602
                Matcher.quoteReplacement(sqlTrail)
603
            );
604
        }
605
606
        // Add ending line comment by vendor
607
        query = query + this.mediatorVendor.getVendor().instance().endingComment();
608
609 1 1. initializeRawInjection : replaced return value with "" for com/jsql/model/InjectionModel::initializeRawInjection → NO_COVERAGE
        return query;
610
    }
611
612
    private String initializeStarInjection(String paramLead, boolean isUsingIndex, String sqlTrail) {
613
        
614
        String query;
615
        
616
        // Several SQL expressions does not use indexes in SELECT,
617
        // like Boolean, Error, Shell and search for character insertion,
618
        // in that case replace injection point by SQL expression.
619
        // Injection point is always at the end?
620 1 1. initializeStarInjection : negated conditional → NO_COVERAGE
        if (!isUsingIndex) {
621
            query = paramLead.replace(
622
                InjectionModel.STAR,
623
                sqlTrail + this.mediatorVendor.getVendor().instance().endingComment()
624
            );
625
        } else {
626
            // Replace injection point by indexes found for Normal strategy
627
            // and use visible Index for injection
628
            query = paramLead.replace(
629
                InjectionModel.STAR,
630
                this.indexesInUrl.replace(
631
                    String.format(VendorYaml.FORMAT_INDEX, this.mediatorStrategy.getSpecificNormal().getVisibleIndex()),
632
                    sqlTrail
633
                )
634
                + this.mediatorVendor.getVendor().instance().endingComment()
635
            );
636
        }
637
        
638 1 1. initializeStarInjection : replaced return value with "" for com/jsql/model/InjectionModel::initializeStarInjection → NO_COVERAGE
        return query;
639
    }
640
641
    /**
642
     * Dependency:
643
     * - Tamper space=>comment
644
     * @param methodInjection
645
     * @param query
646
     * @return
647
     */
648
    private String cleanQuery(AbstractMethodInjection methodInjection, String query) {
649
        
650
        String queryFixed = query;
651
        
652
        if (
653 1 1. cleanQuery : negated conditional → NO_COVERAGE
            methodInjection == this.mediatorMethod.getRequest()
654
            && (
655 1 1. cleanQuery : negated conditional → NO_COVERAGE
                this.mediatorUtils.getParameterUtil().isRequestSoap()
656 1 1. cleanQuery : negated conditional → NO_COVERAGE
                || this.mediatorUtils.getParameterUtil().isMultipartRequest()
657
            )
658
        ) {
659
            queryFixed = StringUtil.removeSqlComment(queryFixed)
660
                .replace("+", " ")
661
                .replace("%2b", "+")  // Failsafe
662
                .replace("%23", "#");  // End comment
663
664 1 1. cleanQuery : negated conditional → NO_COVERAGE
            if (this.mediatorUtils.getParameterUtil().isMultipartRequest()) {
665
                // restore linefeed from textfield
666
                queryFixed = queryFixed.replaceAll("(?s)\\\\n", "\r\n");
667
            }
668
        } else {
669
            queryFixed = StringUtil.cleanSql(queryFixed);
670
        }
671
        
672 1 1. cleanQuery : replaced return value with "" for com/jsql/model/InjectionModel::cleanQuery → NO_COVERAGE
        return queryFixed;
673
    }
674
675
    private String applyEncoding(AbstractMethodInjection methodInjection, String query) {
676
        
677
        String queryFixed = query;
678
        
679 1 1. applyEncoding : negated conditional → NO_COVERAGE
        if (!this.mediatorUtils.getParameterUtil().isRequestSoap()) {
680 1 1. applyEncoding : negated conditional → NO_COVERAGE
            if (methodInjection == this.mediatorMethod.getQuery()) {
681
                
682
                // URL encode each character because no query parameter context
683 1 1. applyEncoding : negated conditional → NO_COVERAGE
                if (!this.mediatorUtils.getPreferencesUtil().isUrlEncodingDisabled()) {
684
685
                    queryFixed = queryFixed.replace("'", "%27");
686
                    queryFixed = queryFixed.replace("(", "%28");
687
                    queryFixed = queryFixed.replace(")", "%29");
688
                    queryFixed = queryFixed.replace("{", "%7b");
689
                    queryFixed = queryFixed.replace("[", "%5b");
690
                    queryFixed = queryFixed.replace("]", "%5d");
691
                    queryFixed = queryFixed.replace("}", "%7d");
692
                    queryFixed = queryFixed.replace(">", "%3e");
693
                    queryFixed = queryFixed.replace("<", "%3c");
694
                    queryFixed = queryFixed.replace("?", "%3f");
695
                    queryFixed = queryFixed.replace("_", "%5f");
696
                    queryFixed = queryFixed.replace(",", "%2c");
697
                }
698
699
                // HTTP forbidden characters
700
                queryFixed = queryFixed.replace(StringUtils.SPACE, "+");
701
                queryFixed = queryFixed.replace("`", "%60");  // from `${database}`.`${table}`
702
                queryFixed = queryFixed.replace("\"", "%22");
703
                queryFixed = queryFixed.replace("|", "%7c");
704
                queryFixed = queryFixed.replace("\\", "%5c");
705
                
706 1 1. applyEncoding : negated conditional → NO_COVERAGE
            } else if (methodInjection != this.mediatorMethod.getRequest()) {
707
                
708
                // For cookies in Spring (confirmed, covered by integration tests)
709
                queryFixed = queryFixed.replace("+", "%20");
710
                queryFixed = queryFixed.replace(",", "%2c");
711
                queryFixed = URLDecoder.decode(queryFixed, StandardCharsets.UTF_8);
712
            }
713
        }
714
        
715 1 1. applyEncoding : replaced return value with "" for com/jsql/model/InjectionModel::applyEncoding → NO_COVERAGE
        return queryFixed;
716
    }
717
    
718
    /**
719
     * Display source code in console.
720
     * @param message Error message
721
     * @param source Text to display in console
722
     */
723
    public void sendResponseFromSite(String message, String source) {
724
        
725
        LOGGER.log(LogLevelUtil.CONSOLE_ERROR, "{}, response from site:", message);
726
        LOGGER.log(LogLevelUtil.CONSOLE_ERROR, ">>>{}", source);
727
    }
728
    
729
    public void displayVersion() {
730
        LOGGER.log(
731
            LogLevelUtil.CONSOLE_DEFAULT,
732
            "jSQL Injection v{} on Java {}-{}-{}",
733
            this::getVersionJsql,
734 1 1. lambda$displayVersion$6 : replaced return value with null for com/jsql/model/InjectionModel::lambda$displayVersion$6 → NO_COVERAGE
            () -> SystemUtils.JAVA_VERSION,
735 1 1. lambda$displayVersion$7 : replaced return value with null for com/jsql/model/InjectionModel::lambda$displayVersion$7 → NO_COVERAGE
            () -> SystemUtils.OS_ARCH,
736 1 1. lambda$displayVersion$8 : replaced return value with null for com/jsql/model/InjectionModel::lambda$displayVersion$8 → NO_COVERAGE
            () -> SystemUtils.USER_LANGUAGE
737
        );
738
    }
739
    
740
    
741
    // Getters and setters
742
743
    public String getIndexesInUrl() {
744 1 1. getIndexesInUrl : replaced return value with "" for com/jsql/model/InjectionModel::getIndexesInUrl → NO_COVERAGE
        return this.indexesInUrl;
745
    }
746
747
    public void setIndexesInUrl(String indexesInUrl) {
748
        this.indexesInUrl = indexesInUrl;
749
    }
750
751
    public boolean shouldErasePreviousInjection() {
752 2 1. shouldErasePreviousInjection : replaced boolean return with false for com/jsql/model/InjectionModel::shouldErasePreviousInjection → NO_COVERAGE
2. shouldErasePreviousInjection : replaced boolean return with true for com/jsql/model/InjectionModel::shouldErasePreviousInjection → NO_COVERAGE
        return this.shouldErasePreviousInjection;
753
    }
754
755
    public void setIsScanning(boolean isScanning) {
756
        this.isScanning = isScanning;
757
    }
758
759
    public String getVersionJsql() {
760 1 1. getVersionJsql : replaced return value with "" for com/jsql/model/InjectionModel::getVersionJsql → SURVIVED
        return this.propertiesUtil.getProperties().getProperty("jsql.version");
761
    }
762
763
    public MediatorUtils getMediatorUtils() {
764 1 1. getMediatorUtils : replaced return value with null for com/jsql/model/InjectionModel::getMediatorUtils → KILLED
        return this.mediatorUtils;
765
    }
766
767
    public MediatorVendor getMediatorVendor() {
768 1 1. getMediatorVendor : replaced return value with null for com/jsql/model/InjectionModel::getMediatorVendor → NO_COVERAGE
        return this.mediatorVendor;
769
    }
770
771
    public MediatorMethod getMediatorMethod() {
772 1 1. getMediatorMethod : replaced return value with null for com/jsql/model/InjectionModel::getMediatorMethod → KILLED
        return this.mediatorMethod;
773
    }
774
775
    public DataAccess getDataAccess() {
776 1 1. getDataAccess : replaced return value with null for com/jsql/model/InjectionModel::getDataAccess → NO_COVERAGE
        return this.dataAccess;
777
    }
778
779
    public ResourceAccess getResourceAccess() {
780 1 1. getResourceAccess : replaced return value with null for com/jsql/model/InjectionModel::getResourceAccess → NO_COVERAGE
        return this.resourceAccess;
781
    }
782
783
    public MediatorStrategy getMediatorStrategy() {
784 1 1. getMediatorStrategy : replaced return value with null for com/jsql/model/InjectionModel::getMediatorStrategy → KILLED
        return this.mediatorStrategy;
785
    }
786
787
    public void appendAnalysisReport(String analysisReport) {
788 1 1. appendAnalysisReport : removed call to com/jsql/model/InjectionModel::appendAnalysisReport → NO_COVERAGE
        this.appendAnalysisReport(analysisReport, false);
789
    }
790
791
    public void appendAnalysisReport(String analysisReport, boolean isInit) {
792 1 1. appendAnalysisReport : negated conditional → NO_COVERAGE
        this.analysisReport += (isInit ? StringUtils.EMPTY : "<br><br>") + analysisReport;
793
    }
794
}

Mutations

98

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setCertificateUtil → SURVIVED

99

1.1
Location : <init>
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
removed call to com/jsql/model/MediatorUtils::setPropertiesUtil → KILLED

100

1.1
Location : <init>
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
removed call to com/jsql/model/MediatorUtils::setConnectionUtil → KILLED

101

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setAuthenticationUtil → SURVIVED

102

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setGitUtil → SURVIVED

103

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setHeaderUtil → SURVIVED

104

1.1
Location : <init>
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
removed call to com/jsql/model/MediatorUtils::setParameterUtil → KILLED

105

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setExceptionUtil → SURVIVED

106

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setSoapUtil → SURVIVED

107

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setMultipartUtil → SURVIVED

108

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setCookiesUtil → SURVIVED

109

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setJsonUtil → SURVIVED

110

1.1
Location : <init>
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
removed call to com/jsql/model/MediatorUtils::setPreferencesUtil → KILLED

111

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setProxyUtil → SURVIVED

112

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setThreadUtil → SURVIVED

113

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setTamperingUtil → SURVIVED

114

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setUserAgentUtil → SURVIVED

115

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setCsrfUtil → SURVIVED

116

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setFormUtil → SURVIVED

117

1.1
Location : <init>
Killed by : none
removed call to com/jsql/model/MediatorUtils::setDigestUtil → SURVIVED

125

1.1
Location : resetModel
Killed by : none
removed call to com/jsql/model/injection/strategy/StrategyInjectionNormal::setVisibleIndex → NO_COVERAGE

127

1.1
Location : resetModel
Killed by : none
removed call to com/jsql/model/injection/strategy/AbstractStrategy::setApplicable → NO_COVERAGE

128

1.1
Location : resetModel
Killed by : none
removed call to com/jsql/model/injection/strategy/StrategyInjectionError::setApplicable → NO_COVERAGE

129

1.1
Location : resetModel
Killed by : none
removed call to com/jsql/model/injection/strategy/AbstractStrategy::setApplicable → NO_COVERAGE

130

1.1
Location : resetModel
Killed by : none
removed call to com/jsql/model/injection/strategy/AbstractStrategy::setApplicable → NO_COVERAGE

131

1.1
Location : resetModel
Killed by : none
removed call to com/jsql/model/injection/strategy/AbstractStrategy::setApplicable → NO_COVERAGE

132

1.1
Location : resetModel
Killed by : none
removed call to com/jsql/model/injection/strategy/AbstractStrategy::setApplicable → NO_COVERAGE

133

1.1
Location : resetModel
Killed by : none
removed call to com/jsql/model/injection/strategy/MediatorStrategy::setStrategy → NO_COVERAGE

140

1.1
Location : resetModel
Killed by : none
removed call to com/jsql/util/CsrfUtil::setTokenCsrf → NO_COVERAGE

141

1.1
Location : resetModel
Killed by : none
removed call to com/jsql/util/DigestUtil::setTokenDigest → NO_COVERAGE

142

1.1
Location : resetModel
Killed by : none
removed call to com/jsql/util/ThreadUtil::reset → NO_COVERAGE

152

1.1
Location : beginInjection
Killed by : none
removed call to com/jsql/model/InjectionModel::resetModel → NO_COVERAGE

155

1.1
Location : beginInjection
Killed by : none
negated conditional → NO_COVERAGE

162

1.1
Location : lambda$beginInjection$0
Killed by : none
replaced return value with null for com/jsql/model/InjectionModel::lambda$beginInjection$0 → NO_COVERAGE

163

1.1
Location : lambda$beginInjection$1
Killed by : none
replaced return value with null for com/jsql/model/InjectionModel::lambda$beginInjection$1 → NO_COVERAGE

167

1.1
Location : beginInjection
Killed by : none
removed call to com/jsql/util/ParameterUtil::checkParametersFormat → NO_COVERAGE

169

1.1
Location : beginInjection
Killed by : none
removed call to com/jsql/util/ConnectionUtil::testConnection → NO_COVERAGE

179

1.1
Location : beginInjection
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : beginInjection
Killed by : none
negated conditional → NO_COVERAGE

181

1.1
Location : beginInjection
Killed by : none
negated conditional → NO_COVERAGE

184

1.1
Location : beginInjection
Killed by : none
removed call to com/jsql/model/bean/util/Request::setMessage → NO_COVERAGE

185

1.1
Location : beginInjection
Killed by : none
removed call to com/jsql/model/bean/util/Request::setParameters → NO_COVERAGE

186

1.1
Location : beginInjection
Killed by : none
removed call to com/jsql/model/InjectionModel::sendToViews → NO_COVERAGE

189

1.1
Location : beginInjection
Killed by : none
negated conditional → NO_COVERAGE

191

1.1
Location : beginInjection
Killed by : none
negated conditional → NO_COVERAGE

195

1.1
Location : beginInjection
Killed by : none
negated conditional → NO_COVERAGE

196

1.1
Location : beginInjection
Killed by : none
removed call to com/jsql/model/accessible/DataAccess::getDatabaseInfos → NO_COVERAGE

209

1.1
Location : beginInjection
Killed by : none
removed call to java/lang/Thread::interrupt → NO_COVERAGE

213

1.1
Location : beginInjection
Killed by : none
negated conditional → NO_COVERAGE

219

1.1
Location : beginInjection
Killed by : none
negated conditional → NO_COVERAGE

225

1.1
Location : beginInjection
Killed by : none
removed call to com/jsql/model/bean/util/Request::setMessage → NO_COVERAGE

226

1.1
Location : beginInjection
Killed by : none
removed call to com/jsql/model/InjectionModel::sendToViews → NO_COVERAGE

234

1.1
Location : getImplicitReason
Killed by : none
negated conditional → NO_COVERAGE

238

1.1
Location : getImplicitReason
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : getImplicitReason
Killed by : none
negated conditional → NO_COVERAGE

242

1.1
Location : getImplicitReason
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::getImplicitReason → NO_COVERAGE

300

1.1
Location : inject
Killed by : none
removed call to com/jsql/util/CsrfUtil::addHeaderToken → NO_COVERAGE

301

1.1
Location : inject
Killed by : none
removed call to com/jsql/util/DigestUtil::addHeaderToken → NO_COVERAGE

303

1.1
Location : inject
Killed by : none
removed call to com/jsql/util/ConnectionUtil::setCustomUserAgent → NO_COVERAGE

306

1.1
Location : inject
Killed by : none
removed call to com/jsql/model/InjectionModel::initializeHeader → NO_COVERAGE

310

1.1
Location : inject
Killed by : none
negated conditional → NO_COVERAGE

314

1.1
Location : inject
Killed by : none
negated conditional → NO_COVERAGE

319

1.1
Location : inject
Killed by : none
negated conditional → NO_COVERAGE

320

1.1
Location : inject
Killed by : none
negated conditional → NO_COVERAGE

326

1.1
Location : lambda$inject$3
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::lambda$inject$3 → NO_COVERAGE

328

1.1
Location : inject
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::inject → NO_COVERAGE

336

1.1
Location : inject
Killed by : none
negated conditional → NO_COVERAGE

350

1.1
Location : lambda$inject$4
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : lambda$inject$4
Killed by : none
replaced Integer return value with 0 for com/jsql/model/InjectionModel::lambda$inject$4 → NO_COVERAGE

354

1.1
Location : inject
Killed by : none
Replaced float division with multiplication → NO_COVERAGE

2.2
Location : inject
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

358

1.1
Location : inject
Killed by : none
negated conditional → NO_COVERAGE

374

1.1
Location : inject
Killed by : none
removed call to com/jsql/model/bean/util/Request::setMessage → NO_COVERAGE

375

1.1
Location : inject
Killed by : none
removed call to com/jsql/model/bean/util/Request::setParameters → NO_COVERAGE

376

1.1
Location : inject
Killed by : none
removed call to com/jsql/model/InjectionModel::sendToViews → NO_COVERAGE

386

1.1
Location : inject
Killed by : none
removed call to java/lang/Thread::interrupt → NO_COVERAGE

390

1.1
Location : inject
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::inject → NO_COVERAGE

405

1.1
Location : initializeQueryString
Killed by : none
negated conditional → NO_COVERAGE

406

1.1
Location : initializeQueryString
Killed by : none
negated conditional → NO_COVERAGE

410

1.1
Location : initializeQueryString
Killed by : none
replaced return value with null for com/jsql/model/InjectionModel::initializeQueryString → NO_COVERAGE

415

1.1
Location : initializeQueryString
Killed by : none
negated conditional → NO_COVERAGE

440

1.1
Location : initializeQueryString
Killed by : none
replaced return value with null for com/jsql/model/InjectionModel::initializeQueryString → NO_COVERAGE

448

1.1
Location : initializeHeader
Killed by : none
negated conditional → NO_COVERAGE

458

1.1
Location : initializeHeader
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

459

1.1
Location : lambda$initializeHeader$5
Killed by : none
negated conditional → NO_COVERAGE

461

1.1
Location : lambda$initializeHeader$5
Killed by : none
removed call to com/jsql/util/HeaderUtil::sanitizeHeaders → NO_COVERAGE

484

1.1
Location : initializeRequest
Killed by : none
negated conditional → NO_COVERAGE

485

1.1
Location : initializeRequest
Killed by : none
negated conditional → NO_COVERAGE

487

1.1
Location : initializeRequest
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::initializeRequest → NO_COVERAGE

495

1.1
Location : initializeRequest
Killed by : none
negated conditional → NO_COVERAGE

501

1.1
Location : initializeRequest
Killed by : none
removed call to com/jsql/util/CsrfUtil::addRequestToken → NO_COVERAGE

503

1.1
Location : initializeRequest
Killed by : none
negated conditional → NO_COVERAGE

504

1.1
Location : initializeRequest
Killed by : none
negated conditional → NO_COVERAGE

542

1.1
Location : initializeRequest
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::initializeRequest → NO_COVERAGE

555

1.1
Location : buildQuery
Killed by : none
negated conditional → NO_COVERAGE

557

1.1
Location : buildQuery
Killed by : none
negated conditional → NO_COVERAGE

565

1.1
Location : buildQuery
Killed by : none
negated conditional → NO_COVERAGE

576

1.1
Location : buildQuery
Killed by : none
negated conditional → NO_COVERAGE

582

1.1
Location : buildQuery
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::buildQuery → NO_COVERAGE

590

1.1
Location : initializeRawInjection
Killed by : none
negated conditional → NO_COVERAGE

609

1.1
Location : initializeRawInjection
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::initializeRawInjection → NO_COVERAGE

620

1.1
Location : initializeStarInjection
Killed by : none
negated conditional → NO_COVERAGE

638

1.1
Location : initializeStarInjection
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::initializeStarInjection → NO_COVERAGE

653

1.1
Location : cleanQuery
Killed by : none
negated conditional → NO_COVERAGE

655

1.1
Location : cleanQuery
Killed by : none
negated conditional → NO_COVERAGE

656

1.1
Location : cleanQuery
Killed by : none
negated conditional → NO_COVERAGE

664

1.1
Location : cleanQuery
Killed by : none
negated conditional → NO_COVERAGE

672

1.1
Location : cleanQuery
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::cleanQuery → NO_COVERAGE

679

1.1
Location : applyEncoding
Killed by : none
negated conditional → NO_COVERAGE

680

1.1
Location : applyEncoding
Killed by : none
negated conditional → NO_COVERAGE

683

1.1
Location : applyEncoding
Killed by : none
negated conditional → NO_COVERAGE

706

1.1
Location : applyEncoding
Killed by : none
negated conditional → NO_COVERAGE

715

1.1
Location : applyEncoding
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::applyEncoding → NO_COVERAGE

734

1.1
Location : lambda$displayVersion$6
Killed by : none
replaced return value with null for com/jsql/model/InjectionModel::lambda$displayVersion$6 → NO_COVERAGE

735

1.1
Location : lambda$displayVersion$7
Killed by : none
replaced return value with null for com/jsql/model/InjectionModel::lambda$displayVersion$7 → NO_COVERAGE

736

1.1
Location : lambda$displayVersion$8
Killed by : none
replaced return value with null for com/jsql/model/InjectionModel::lambda$displayVersion$8 → NO_COVERAGE

744

1.1
Location : getIndexesInUrl
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::getIndexesInUrl → NO_COVERAGE

752

1.1
Location : shouldErasePreviousInjection
Killed by : none
replaced boolean return with false for com/jsql/model/InjectionModel::shouldErasePreviousInjection → NO_COVERAGE

2.2
Location : shouldErasePreviousInjection
Killed by : none
replaced boolean return with true for com/jsql/model/InjectionModel::shouldErasePreviousInjection → NO_COVERAGE

760

1.1
Location : getVersionJsql
Killed by : none
replaced return value with "" for com/jsql/model/InjectionModel::getVersionJsql → SURVIVED

764

1.1
Location : getMediatorUtils
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
replaced return value with null for com/jsql/model/InjectionModel::getMediatorUtils → KILLED

768

1.1
Location : getMediatorVendor
Killed by : none
replaced return value with null for com/jsql/model/InjectionModel::getMediatorVendor → NO_COVERAGE

772

1.1
Location : getMediatorMethod
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_1]
replaced return value with null for com/jsql/model/InjectionModel::getMediatorMethod → KILLED

776

1.1
Location : getDataAccess
Killed by : none
replaced return value with null for com/jsql/model/InjectionModel::getDataAccess → NO_COVERAGE

780

1.1
Location : getResourceAccess
Killed by : none
replaced return value with null for com/jsql/model/InjectionModel::getResourceAccess → NO_COVERAGE

784

1.1
Location : getMediatorStrategy
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
replaced return value with null for com/jsql/model/InjectionModel::getMediatorStrategy → KILLED

788

1.1
Location : appendAnalysisReport
Killed by : none
removed call to com/jsql/model/InjectionModel::appendAnalysisReport → NO_COVERAGE

792

1.1
Location : appendAnalysisReport
Killed by : none
negated conditional → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1