1
2
3
4
5
6
7
8
9
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
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
35 Map<Header, Object> mapHeader = (Map<Header, Object>) interactionParams[0];
36 this.indexMethodError = (int) mapHeader.get(Header.INDEX_ERROR_STRATEGY);
37 this.injectionModel = (InjectionModel) mapHeader.get(Header.INJECTION_MODEL);
38 }
39
40 @Override
41 public void execute() {
42 LOGGER.info(
43 () -> AnsiColorUtil.addGreenColor(
44 this.injectionModel
45 .getMediatorVendor()
46 .getVendor()
47 .instance()
48 .getModelYaml()
49 .getStrategy()
50 .getError()
51 .getMethod()
52 .get(this.indexMethodError)
53 .getName()
54 )
55 );
56 }
57 }