SubscriberView.java

1
package com.jsql.view.subscriber;
2
3
import com.jsql.model.injection.strategy.AbstractStrategy;
4
import com.jsql.model.injection.strategy.StrategyError;
5
import com.jsql.util.LogLevelUtil;
6
import com.jsql.view.swing.panel.consoles.NetworkTable;
7
import com.jsql.view.swing.terminal.AbstractExploit;
8
import com.jsql.view.swing.util.MediatorHelper;
9
import org.apache.logging.log4j.LogManager;
10
import org.apache.logging.log4j.Logger;
11
12
import javax.swing.table.DefaultTableModel;
13
import java.awt.*;
14
import java.util.Arrays;
15
import java.util.UUID;
16
17
public class SubscriberView extends AbstractSubscriber {
18
19
    private static final Logger LOGGER = LogManager.getRootLogger();
20
21
    @Override
22
    protected void execute(Seal request) {
23 1 1. execute : removed call to com/jsql/view/subscriber/SubscriberView::addLog → NO_COVERAGE
        this.addLog(request);
24 1 1. execute : removed call to com/jsql/view/subscriber/SubscriberView::progress → NO_COVERAGE
        this.progress(request);
25 1 1. execute : removed call to com/jsql/view/subscriber/SubscriberView::executeInjection → NO_COVERAGE
        this.executeInjection(request);
26 1 1. execute : removed call to com/jsql/view/subscriber/SubscriberView::createTab → NO_COVERAGE
        this.createTab(request);
27 1 1. execute : removed call to com/jsql/view/subscriber/SubscriberView::executeExploit → NO_COVERAGE
        this.executeExploit(request);
28
    }
29
30
    private void executeInjection(Seal request) {
31
        switch (request) {
32 1 1. executeInjection : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::setEngine → NO_COVERAGE
            case Seal.ActivateEngine(var engine) -> MediatorHelper.panelAddressBar().getPanelTrailingAddress().setEngine(engine);
33 1 1. executeInjection : removed call to com/jsql/view/swing/tree/TreeDatabase::addColumns → NO_COVERAGE
            case Seal.AddColumns(var columns) -> MediatorHelper.treeDatabase().addColumns(columns);
34 1 1. executeInjection : removed call to com/jsql/view/swing/tree/TreeDatabase::addTables → NO_COVERAGE
            case Seal.AddTables(var tables) -> MediatorHelper.treeDatabase().addTables(tables);
35 1 1. executeInjection : removed call to com/jsql/view/swing/tree/TreeDatabase::addDatabases → NO_COVERAGE
            case Seal.AddDatabases(var databases) -> MediatorHelper.treeDatabase().addDatabases(databases);
36
37
            case Seal.MarkStrategyInvulnerable(int indexError, AbstractStrategy strategy) -> {
38 1 1. executeInjection : negated conditional → NO_COVERAGE
                if (strategy instanceof StrategyError) {
39 1 1. executeInjection : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::markInvulnerable → NO_COVERAGE
                    MediatorHelper.panelAddressBar().getPanelTrailingAddress().markInvulnerable(indexError, strategy);
40
                } else {
41 1 1. executeInjection : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::markInvulnerable → NO_COVERAGE
                    MediatorHelper.panelAddressBar().getPanelTrailingAddress().markInvulnerable(strategy);
42
                }
43
            }
44
            case Seal.MarkStrategyVulnerable(int indexError, var strategy) -> {
45 1 1. executeInjection : negated conditional → NO_COVERAGE
                if (strategy instanceof StrategyError) {
46 1 1. executeInjection : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::markVulnerable → NO_COVERAGE
                    MediatorHelper.panelAddressBar().getPanelTrailingAddress().markVulnerable(indexError, strategy);
47
                } else {
48 1 1. executeInjection : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::markVulnerable → NO_COVERAGE
                    MediatorHelper.panelAddressBar().getPanelTrailingAddress().markVulnerable(strategy);
49
                }
50
            }
51 1 1. executeInjection : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::activateStrategy → NO_COVERAGE
            case Seal.ActivateStrategy(var strategy) -> MediatorHelper.panelAddressBar().getPanelTrailingAddress().activateStrategy(strategy);
52
53 1 1. executeInjection : removed call to com/jsql/view/swing/tab/TabManagersCards::markFileSystemInvulnerable → NO_COVERAGE
            case Seal.MarkFileSystemInvulnerable ignored -> MediatorHelper.tabManagersCards().markFileSystemInvulnerable();
54 1 1. executeInjection : removed call to com/jsql/view/swing/tab/TabManagersCards::markFileSystemVulnerable → NO_COVERAGE
            case Seal.MarkFileSystemVulnerable ignored -> MediatorHelper.tabManagersCards().markFileSystemVulnerable();
55
            default -> {
56
                // ignore
57
            }
58
        }
59
    }
60
61
    private void executeExploit(Seal request) {
62
        switch (request) {
63 1 1. executeExploit : removed call to com/jsql/view/swing/tab/TabResults::addTabExploitSql → NO_COVERAGE
            case Seal.AddTabExploitSql(var urlSuccess, var username, var password) -> MediatorHelper.tabResults().addTabExploitSql(urlSuccess, username, password);
64 1 1. executeExploit : removed call to com/jsql/view/swing/tab/TabResults::addTabExploitUdf → NO_COVERAGE
            case Seal.AddTabExploitUdf(var biConsumerRunCmd) -> MediatorHelper.tabResults().addTabExploitUdf(biConsumerRunCmd);
65 1 1. executeExploit : removed call to com/jsql/view/swing/tab/TabResults::addTabExploitWeb → NO_COVERAGE
            case Seal.AddTabExploitWeb(String urlSuccess) -> MediatorHelper.tabResults().addTabExploitWeb(urlSuccess);
66
            case Seal.GetTerminalResult(UUID uuidShell, String result) -> {
67
                AbstractExploit terminal = MediatorHelper.frame().getMapUuidShell().get(uuidShell);
68 1 1. executeExploit : negated conditional → NO_COVERAGE
                if (terminal != null) {  // null on reverse shell connection
69 1 1. executeExploit : removed call to com/jsql/view/swing/terminal/AbstractExploit::append → NO_COVERAGE
                    terminal.append(result);
70 1 1. executeExploit : removed call to com/jsql/view/swing/terminal/AbstractExploit::append → NO_COVERAGE
                    terminal.append("\n");
71 1 1. executeExploit : removed call to com/jsql/view/swing/terminal/AbstractExploit::reset → NO_COVERAGE
                    terminal.reset();
72
                }
73
            }
74
            default -> {
75
                // ignore
76
            }
77
        }
78
    }
79
80
    private void addLog(Seal request) {
81
        switch (request) {
82
            case Seal.MessageBinary(var message) -> {
83 1 1. addLog : removed call to com/jsql/view/swing/panel/PanelConsoles::messageBinary → NO_COVERAGE
                MediatorHelper.panelConsoles().messageBinary(message);
84 1 1. addLog : removed call to com/jsql/view/swing/tab/TabbedPaneWheeled::setBold → NO_COVERAGE
                MediatorHelper.tabConsoles().setBold("Boolean");
85
            }
86
            case Seal.MessageChunk(var message) -> {
87 1 1. addLog : removed call to com/jsql/view/swing/panel/PanelConsoles::messageChunk → NO_COVERAGE
                MediatorHelper.panelConsoles().messageChunk(message);
88 1 1. addLog : removed call to com/jsql/view/swing/tab/TabbedPaneWheeled::setBold → NO_COVERAGE
                MediatorHelper.tabConsoles().setBold("Chunk");
89
            }
90
            case Seal.MessageHeader r -> {
91
                NetworkTable table = MediatorHelper.panelConsoles().getNetworkTable();
92 1 1. addLog : removed call to com/jsql/view/swing/panel/consoles/NetworkTable::addHeader → NO_COVERAGE
                table.addHeader(r);
93
                DefaultTableModel model = (DefaultTableModel) table.getModel();
94
                try {
95 1 1. addLog : removed call to javax/swing/table/DefaultTableModel::addRow → NO_COVERAGE
                    model.addRow(new Object[] {
96
                        r.url(),
97
                        r.size(),
98
                        r.metadataStrategy(),
99
                        Arrays.asList(r.metadataProcess(), r.metadataBoolean())
100
                    });
101
102 1 1. addLog : Replaced integer subtraction with addition → NO_COVERAGE
                    Rectangle rect = table.getCellRect(table.getRowCount() - 1, 0, true);
103 1 1. addLog : removed call to com/jsql/view/swing/panel/consoles/NetworkTable::scrollRectToVisible → NO_COVERAGE
                    table.scrollRectToVisible(rect);
104
105 1 1. addLog : removed call to com/jsql/view/swing/tab/TabbedPaneWheeled::setBold → NO_COVERAGE
                    MediatorHelper.tabConsoles().setBold("Network");
106
                } catch(NullPointerException | IndexOutOfBoundsException e) {
107
                    // Fix #4658, #2224, #1797 on model.addRow()
108
                    LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e);
109
                }
110
            }
111
            default -> {
112
                // ignore
113
            }
114
        }
115
    }
116
117
    private void createTab(Seal request) {
118
        switch (request) {
119 1 1. createTab : removed call to com/jsql/view/swing/tab/TabResults::addAdminTab → NO_COVERAGE
            case Seal.CreateAdminPageTab(String urlSuccess) -> MediatorHelper.tabResults().addAdminTab(urlSuccess);
120 1 1. createTab : removed call to com/jsql/view/swing/tab/TabResults::addReportTab → NO_COVERAGE
            case Seal.CreateAnalysisReport(var content) -> MediatorHelper.tabResults().addReportTab(content.trim());
121 1 1. createTab : removed call to com/jsql/view/swing/tab/TabResults::addFileTab → NO_COVERAGE
            case Seal.CreateFileTab(var name, var content, var path) -> MediatorHelper.tabResults().addFileTab(name, content, path);
122 1 1. createTab : removed call to com/jsql/view/swing/tree/TreeDatabase::createValuesTab → NO_COVERAGE
            case Seal.CreateValuesTab(var columns, var table, var tableBean) -> MediatorHelper.treeDatabase().createValuesTab(table, columns, tableBean);
123
            default -> {
124
                // ignore
125
            }
126
        }
127
    }
128
129
    private void progress(Seal request) {
130
        switch (request) {
131 1 1. progress : removed call to com/jsql/view/swing/tree/TreeDatabase::startIndeterminateProgress → NO_COVERAGE
            case Seal.StartIndeterminateProgress(var table) -> MediatorHelper.treeDatabase().startIndeterminateProgress(table);
132 1 1. progress : removed call to com/jsql/view/swing/tree/TreeDatabase::startProgress → NO_COVERAGE
            case Seal.StartProgress(var elementDatabase) -> MediatorHelper.treeDatabase().startProgress(elementDatabase);
133 1 1. progress : removed call to com/jsql/view/swing/tree/TreeDatabase::updateProgress → NO_COVERAGE
            case Seal.UpdateProgress(var database, var countProgress) -> MediatorHelper.treeDatabase().updateProgress(database, countProgress);
134 1 1. progress : removed call to com/jsql/view/swing/tree/TreeDatabase::endIndeterminateProgress → NO_COVERAGE
            case Seal.EndIndeterminateProgress(var table) -> MediatorHelper.treeDatabase().endIndeterminateProgress(table);
135
            case Seal.EndPreparation ignored -> {
136 1 1. progress : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::endPreparation → NO_COVERAGE
                MediatorHelper.panelAddressBar().getPanelTrailingAddress().endPreparation();
137 1 1. progress : negated conditional → NO_COVERAGE
                if (MediatorHelper.model().shouldErasePreviousInjection()) {
138 1 1. progress : removed call to com/jsql/view/swing/tab/TabManagersCards::endPreparation → NO_COVERAGE
                    MediatorHelper.tabManagersCards().endPreparation();
139
                }
140
            }
141 1 1. progress : removed call to com/jsql/view/swing/tree/TreeDatabase::endProgress → NO_COVERAGE
            case Seal.EndProgress(var elementDatabase) -> MediatorHelper.treeDatabase().endProgress(elementDatabase);
142
            default -> {
143
                // ignore
144
            }
145
        }
146
    }
147
}

Mutations

23

1.1
Location : execute
Killed by : none
removed call to com/jsql/view/subscriber/SubscriberView::addLog → NO_COVERAGE

24

1.1
Location : execute
Killed by : none
removed call to com/jsql/view/subscriber/SubscriberView::progress → NO_COVERAGE

25

1.1
Location : execute
Killed by : none
removed call to com/jsql/view/subscriber/SubscriberView::executeInjection → NO_COVERAGE

26

1.1
Location : execute
Killed by : none
removed call to com/jsql/view/subscriber/SubscriberView::createTab → NO_COVERAGE

27

1.1
Location : execute
Killed by : none
removed call to com/jsql/view/subscriber/SubscriberView::executeExploit → NO_COVERAGE

32

1.1
Location : executeInjection
Killed by : none
removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::setEngine → NO_COVERAGE

33

1.1
Location : executeInjection
Killed by : none
removed call to com/jsql/view/swing/tree/TreeDatabase::addColumns → NO_COVERAGE

34

1.1
Location : executeInjection
Killed by : none
removed call to com/jsql/view/swing/tree/TreeDatabase::addTables → NO_COVERAGE

35

1.1
Location : executeInjection
Killed by : none
removed call to com/jsql/view/swing/tree/TreeDatabase::addDatabases → NO_COVERAGE

38

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

39

1.1
Location : executeInjection
Killed by : none
removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::markInvulnerable → NO_COVERAGE

41

1.1
Location : executeInjection
Killed by : none
removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::markInvulnerable → NO_COVERAGE

45

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

46

1.1
Location : executeInjection
Killed by : none
removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::markVulnerable → NO_COVERAGE

48

1.1
Location : executeInjection
Killed by : none
removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::markVulnerable → NO_COVERAGE

51

1.1
Location : executeInjection
Killed by : none
removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::activateStrategy → NO_COVERAGE

53

1.1
Location : executeInjection
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersCards::markFileSystemInvulnerable → NO_COVERAGE

54

1.1
Location : executeInjection
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersCards::markFileSystemVulnerable → NO_COVERAGE

63

1.1
Location : executeExploit
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::addTabExploitSql → NO_COVERAGE

64

1.1
Location : executeExploit
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::addTabExploitUdf → NO_COVERAGE

65

1.1
Location : executeExploit
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::addTabExploitWeb → NO_COVERAGE

68

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

69

1.1
Location : executeExploit
Killed by : none
removed call to com/jsql/view/swing/terminal/AbstractExploit::append → NO_COVERAGE

70

1.1
Location : executeExploit
Killed by : none
removed call to com/jsql/view/swing/terminal/AbstractExploit::append → NO_COVERAGE

71

1.1
Location : executeExploit
Killed by : none
removed call to com/jsql/view/swing/terminal/AbstractExploit::reset → NO_COVERAGE

83

1.1
Location : addLog
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::messageBinary → NO_COVERAGE

84

1.1
Location : addLog
Killed by : none
removed call to com/jsql/view/swing/tab/TabbedPaneWheeled::setBold → NO_COVERAGE

87

1.1
Location : addLog
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::messageChunk → NO_COVERAGE

88

1.1
Location : addLog
Killed by : none
removed call to com/jsql/view/swing/tab/TabbedPaneWheeled::setBold → NO_COVERAGE

92

1.1
Location : addLog
Killed by : none
removed call to com/jsql/view/swing/panel/consoles/NetworkTable::addHeader → NO_COVERAGE

95

1.1
Location : addLog
Killed by : none
removed call to javax/swing/table/DefaultTableModel::addRow → NO_COVERAGE

102

1.1
Location : addLog
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

103

1.1
Location : addLog
Killed by : none
removed call to com/jsql/view/swing/panel/consoles/NetworkTable::scrollRectToVisible → NO_COVERAGE

105

1.1
Location : addLog
Killed by : none
removed call to com/jsql/view/swing/tab/TabbedPaneWheeled::setBold → NO_COVERAGE

119

1.1
Location : createTab
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::addAdminTab → NO_COVERAGE

120

1.1
Location : createTab
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::addReportTab → NO_COVERAGE

121

1.1
Location : createTab
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::addFileTab → NO_COVERAGE

122

1.1
Location : createTab
Killed by : none
removed call to com/jsql/view/swing/tree/TreeDatabase::createValuesTab → NO_COVERAGE

131

1.1
Location : progress
Killed by : none
removed call to com/jsql/view/swing/tree/TreeDatabase::startIndeterminateProgress → NO_COVERAGE

132

1.1
Location : progress
Killed by : none
removed call to com/jsql/view/swing/tree/TreeDatabase::startProgress → NO_COVERAGE

133

1.1
Location : progress
Killed by : none
removed call to com/jsql/view/swing/tree/TreeDatabase::updateProgress → NO_COVERAGE

134

1.1
Location : progress
Killed by : none
removed call to com/jsql/view/swing/tree/TreeDatabase::endIndeterminateProgress → NO_COVERAGE

136

1.1
Location : progress
Killed by : none
removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::endPreparation → NO_COVERAGE

137

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

138

1.1
Location : progress
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersCards::endPreparation → NO_COVERAGE

141

1.1
Location : progress
Killed by : none
removed call to com/jsql/view/swing/tree/TreeDatabase::endProgress → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.22.1