TabManagersProxy.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.view.swing.tab;
12
13
import com.jsql.util.I18nUtil;
14
import com.jsql.view.swing.manager.*;
15
import com.jsql.view.swing.util.MediatorHelper;
16
import com.jsql.view.swing.util.UiUtil;
17
import org.apache.commons.lang3.StringUtils;
18
19
import javax.swing.*;
20
import javax.swing.plaf.metal.MetalTabbedPaneUI;
21
import java.awt.*;
22
23
/**
24
 * Panel on the left with functionalities like webshell, file reading and admin page finder.
25
 */
26
public class TabManagersProxy extends JTabbedPane {
27
    
28
    private final ManagerWebShell managerWebShell = new ManagerWebShell();
29
    private final ManagerFile managerFile = new ManagerFile();
30
    private final ManagerUpload managerUpload = new ManagerUpload();
31
    private final ManagerSqlShell managerSqlShell = new ManagerSqlShell();
32
    
33
    /**
34
     * Create manager panel.
35
     */
36
    public TabManagersProxy() {
37
        
38 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::setName → NO_COVERAGE
        this.setName("tabManagersProxy");
39
        
40
        // Hide tab headers
41 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::setUI → NO_COVERAGE
        this.setUI(new MetalTabbedPaneUI() {
42
            
43
            @Override
44
            protected int calculateTabAreaHeight(int tabPlacement, int horizRunCount, int maxTabHeight) {
45
                
46
                return 0;
47
            }
48
        });
49
        
50
        var managerScanList = new ManagerScan();
51
        var managerDatabase = new ManagerDatabase();
52
        var managerAdminPage = new ManagerAdminPage();
53
        var managerBruteForce = new ManagerBruteForce();
54
        
55 1 1. <init> : removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE
        MediatorHelper.register(this.managerWebShell);
56 1 1. <init> : removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE
        MediatorHelper.register(this.managerFile);
57 1 1. <init> : removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE
        MediatorHelper.register(this.managerUpload);
58 1 1. <init> : removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE
        MediatorHelper.register(this.managerSqlShell);
59 1 1. <init> : removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE
        MediatorHelper.register(managerScanList);
60 1 1. <init> : removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE
        MediatorHelper.register(managerAdminPage);
61 1 1. <init> : removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE
        MediatorHelper.register(managerBruteForce);
62
        
63 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::setMinimumSize → NO_COVERAGE
        this.setMinimumSize(new Dimension(100, 0));
64
        
65 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("DATABASE_TAB", UiUtil.ICON_DATABASE_SERVER, managerDatabase);
66 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("ADMINPAGE_TAB", UiUtil.ICON_ADMIN_SERVER, managerAdminPage);
67 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("FILE_TAB", UiUtil.ICON_FILE_SERVER, this.managerFile);
68 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("WEBSHELL_TAB", UiUtil.ICON_SHELL_SERVER, this.managerWebShell);
69 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("SQLSHELL_TAB", UiUtil.ICON_SHELL_SERVER, this.managerSqlShell);
70 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("UPLOAD_TAB", UiUtil.ICON_UPLOAD, this.managerUpload);
71 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("BRUTEFORCE_TAB", UiUtil.ICON_BRUTER, managerBruteForce);
72 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("CODER_TAB", UiUtil.ICON_CODER, new ManagerCoder());
73 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("SCANLIST_TAB", UiUtil.ICON_SCANLIST, managerScanList);
74
    }
75
    
76
    public void addToLists(String path, String name) {
77
        
78
        // Add the path String to the list of files only if there is no same StringObject value already
79 1 1. addToLists : removed call to com/jsql/view/swing/manager/ManagerWebShell::addToList → NO_COVERAGE
        this.managerWebShell.addToList(path.replace(name, StringUtils.EMPTY));
80 1 1. addToLists : removed call to com/jsql/view/swing/manager/ManagerUpload::addToList → NO_COVERAGE
        this.managerUpload.addToList(path.replace(name, StringUtils.EMPTY));
81 1 1. addToLists : removed call to com/jsql/view/swing/manager/ManagerSqlShell::addToList → NO_COVERAGE
        this.managerSqlShell.addToList(path.replace(name, StringUtils.EMPTY));
82
    }
83
    
84
    public void markFileSystemInvulnerable() {
85
        
86 1 1. markFileSystemInvulnerable : removed call to com/jsql/view/swing/manager/ManagerFile::changePrivilegeIcon → NO_COVERAGE
        this.managerFile.changePrivilegeIcon(UiUtil.ICON_SQUARE_RED);
87 1 1. markFileSystemInvulnerable : removed call to com/jsql/view/swing/manager/ManagerFile::endProcess → NO_COVERAGE
        this.managerFile.endProcess();
88
        
89 1 1. markFileSystemInvulnerable : removed call to com/jsql/view/swing/manager/ManagerWebShell::changePrivilegeIcon → NO_COVERAGE
        this.managerWebShell.changePrivilegeIcon(UiUtil.ICON_SQUARE_RED);
90 1 1. markFileSystemInvulnerable : removed call to com/jsql/view/swing/manager/ManagerWebShell::endProcess → NO_COVERAGE
        this.managerWebShell.endProcess();
91
        
92 1 1. markFileSystemInvulnerable : removed call to com/jsql/view/swing/manager/ManagerUpload::changePrivilegeIcon → NO_COVERAGE
        this.managerUpload.changePrivilegeIcon(UiUtil.ICON_SQUARE_RED);
93 1 1. markFileSystemInvulnerable : removed call to com/jsql/view/swing/manager/ManagerUpload::endProcess → NO_COVERAGE
        this.managerUpload.endProcess();
94
        
95 1 1. markFileSystemInvulnerable : removed call to com/jsql/view/swing/manager/ManagerSqlShell::changePrivilegeIcon → NO_COVERAGE
        this.managerSqlShell.changePrivilegeIcon(UiUtil.ICON_SQUARE_RED);
96 1 1. markFileSystemInvulnerable : removed call to com/jsql/view/swing/manager/ManagerSqlShell::endProcess → NO_COVERAGE
        this.managerSqlShell.endProcess();
97
    }
98
    
99
    public void endPreparation() {
100
        
101 1 1. endPreparation : removed call to com/jsql/view/swing/manager/ManagerFile::setButtonEnable → NO_COVERAGE
        this.managerFile.setButtonEnable(true);
102 1 1. endPreparation : removed call to com/jsql/view/swing/manager/ManagerWebShell::setButtonEnable → NO_COVERAGE
        this.managerWebShell.setButtonEnable(true);
103 1 1. endPreparation : removed call to com/jsql/view/swing/manager/ManagerSqlShell::setButtonEnable → NO_COVERAGE
        this.managerSqlShell.setButtonEnable(true);
104 1 1. endPreparation : removed call to com/jsql/view/swing/manager/ManagerUpload::setButtonEnable → NO_COVERAGE
        this.managerUpload.setButtonEnable(true);
105
    }
106
    
107
    public void markFileSystemVulnerable() {
108
        
109 1 1. markFileSystemVulnerable : removed call to com/jsql/view/swing/manager/ManagerFile::changePrivilegeIcon → NO_COVERAGE
        this.managerFile.changePrivilegeIcon(UiUtil.ICON_TICK);
110 1 1. markFileSystemVulnerable : removed call to com/jsql/view/swing/manager/ManagerWebShell::changePrivilegeIcon → NO_COVERAGE
        this.managerWebShell.changePrivilegeIcon(UiUtil.ICON_TICK);
111 1 1. markFileSystemVulnerable : removed call to com/jsql/view/swing/manager/ManagerSqlShell::changePrivilegeIcon → NO_COVERAGE
        this.managerSqlShell.changePrivilegeIcon(UiUtil.ICON_TICK);
112 1 1. markFileSystemVulnerable : removed call to com/jsql/view/swing/manager/ManagerUpload::changePrivilegeIcon → NO_COVERAGE
        this.managerUpload.changePrivilegeIcon(UiUtil.ICON_TICK);
113
    }
114
    
115
    private void buildI18nTab(String keyLabel, Icon icon, Component manager) {
116 1 1. buildI18nTab : removed call to com/jsql/view/swing/tab/TabManagersProxy::addTab → NO_COVERAGE
        this.addTab(I18nUtil.valueByKey(keyLabel), icon, manager);
117
    }
118
}

Mutations

38

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::setName → NO_COVERAGE

41

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::setUI → NO_COVERAGE

55

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE

56

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE

57

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE

58

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE

59

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE

60

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE

61

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE

63

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::setMinimumSize → NO_COVERAGE

65

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE

66

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE

67

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE

68

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE

69

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE

70

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE

71

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE

72

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE

73

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::buildI18nTab → NO_COVERAGE

79

1.1
Location : addToLists
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerWebShell::addToList → NO_COVERAGE

80

1.1
Location : addToLists
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerUpload::addToList → NO_COVERAGE

81

1.1
Location : addToLists
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerSqlShell::addToList → NO_COVERAGE

86

1.1
Location : markFileSystemInvulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerFile::changePrivilegeIcon → NO_COVERAGE

87

1.1
Location : markFileSystemInvulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerFile::endProcess → NO_COVERAGE

89

1.1
Location : markFileSystemInvulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerWebShell::changePrivilegeIcon → NO_COVERAGE

90

1.1
Location : markFileSystemInvulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerWebShell::endProcess → NO_COVERAGE

92

1.1
Location : markFileSystemInvulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerUpload::changePrivilegeIcon → NO_COVERAGE

93

1.1
Location : markFileSystemInvulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerUpload::endProcess → NO_COVERAGE

95

1.1
Location : markFileSystemInvulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerSqlShell::changePrivilegeIcon → NO_COVERAGE

96

1.1
Location : markFileSystemInvulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerSqlShell::endProcess → NO_COVERAGE

101

1.1
Location : endPreparation
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerFile::setButtonEnable → NO_COVERAGE

102

1.1
Location : endPreparation
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerWebShell::setButtonEnable → NO_COVERAGE

103

1.1
Location : endPreparation
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerSqlShell::setButtonEnable → NO_COVERAGE

104

1.1
Location : endPreparation
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerUpload::setButtonEnable → NO_COVERAGE

109

1.1
Location : markFileSystemVulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerFile::changePrivilegeIcon → NO_COVERAGE

110

1.1
Location : markFileSystemVulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerWebShell::changePrivilegeIcon → NO_COVERAGE

111

1.1
Location : markFileSystemVulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerSqlShell::changePrivilegeIcon → NO_COVERAGE

112

1.1
Location : markFileSystemVulnerable
Killed by : none
removed call to com/jsql/view/swing/manager/ManagerUpload::changePrivilegeIcon → NO_COVERAGE

116

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::addTab → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1