use of com.jsql.model.injection.vendor.MediatorVendor in project jsql-injection by ron190.
the class SuspendableGetCharInsertion method run.
@Override
public String run(Object... args) throws JSqlException {
String characterInsertionByUser = (String) args[0];
ExecutorService taskExecutor = this.injectionModel.getMediatorUtils().getThreadUtil().getExecutor("CallableGetInsertionCharacter");
CompletionService<CallablePageSource> taskCompletionService = new ExecutorCompletionService<>(taskExecutor);
var charFromBooleanMatch = new String[1];
List<String> charactersInsertion = this.initializeCallables(taskCompletionService, characterInsertionByUser, charFromBooleanMatch);
var mediatorVendor = this.injectionModel.getMediatorVendor();
LOGGER.log(LogLevel.CONSOLE_DEFAULT, "Fingerprinting database and character insertion with Order by match...");
String charFromOrderBy = null;
int total = charactersInsertion.size();
while (0 < total) {
if (this.isSuspended()) {
throw new StoppedByUserSlidingException();
}
try {
CallablePageSource currentCallable = taskCompletionService.take().get();
total--;
String pageSource = currentCallable.getContent();
List<Vendor> vendorsOrderByMatch = this.getVendorsOrderByMatch(mediatorVendor, pageSource);
if (!vendorsOrderByMatch.isEmpty()) {
this.setVendor(mediatorVendor, vendorsOrderByMatch);
LOGGER.log(LogLevel.CONSOLE_INFORM, "Using [{}]", mediatorVendor.getVendor());
var requestSetVendor = new Request();
requestSetVendor.setMessage(Interaction.SET_VENDOR);
requestSetVendor.setParameters(mediatorVendor.getVendor());
this.injectionModel.sendToViews(requestSetVendor);
// Char insertion
charFromOrderBy = currentCallable.getCharacterInsertion();
LOGGER.log(LogLevel.CONSOLE_SUCCESS, "Character insertion [{}] matching with Order by and compatible with Error strategy", charFromOrderBy);
break;
}
} catch (InterruptedException e) {
LOGGER.log(LogLevel.CONSOLE_JAVA, e, e);
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
LOGGER.log(LogLevel.CONSOLE_JAVA, e, e);
}
}
// End the job
try {
taskExecutor.shutdown();
if (!taskExecutor.awaitTermination(15, TimeUnit.SECONDS)) {
taskExecutor.shutdownNow();
}
} catch (InterruptedException e) {
LOGGER.log(LogLevel.CONSOLE_JAVA, e, e);
Thread.currentThread().interrupt();
}
if (charFromOrderBy == null && charFromBooleanMatch[0] != null) {
charFromOrderBy = charFromBooleanMatch[0];
}
return this.getCharacterInsertion(characterInsertionByUser, charFromOrderBy);
}
Aggregations