ActionListenerSave.java

1
package com.jsql.view.swing.panel.preferences.listener;
2
3
import com.jsql.view.swing.action.ActionNewWindow;
4
import com.jsql.view.swing.panel.PanelPreferences;
5
import com.jsql.view.swing.util.MediatorHelper;
6
7
import javax.swing.*;
8
import java.awt.event.ActionEvent;
9
import java.awt.event.ActionListener;
10
11
public class ActionListenerSave implements ActionListener {
12
    
13
    private final PanelPreferences panelPreferences;
14
15
    public ActionListenerSave(PanelPreferences panelPreferences) {
16
        this.panelPreferences = panelPreferences;
17
    }
18
19
    @Override
20
    public void actionPerformed(ActionEvent e) {
21
        MediatorHelper.model().getMediatorUtils().getPreferencesUtil()
22
        
23
        .withIsCheckingUpdate(this.panelPreferences.getPanelGeneral().getCheckboxIsCheckingUpdate().isSelected())
24
        .withIsReportingBugs(this.panelPreferences.getPanelGeneral().getCheckboxIsReportingBugs().isSelected())
25
        .withIs4K(this.panelPreferences.getPanelGeneral().getCheckboxIs4K().isSelected())
26
        
27
        .withIsFollowingRedirection(this.panelPreferences.getPanelConnection().getCheckboxIsFollowingRedirection().isSelected())
28
        .withIsHttp2Disabled(this.panelPreferences.getPanelConnection().getCheckboxIsHttp2Disabled().isSelected())
29
        .withIsUnicodeDecodeDisabled(this.panelPreferences.getPanelConnection().getCheckboxIsUnicodeDecodeDisabled().isSelected())
30
        .withIsUrlDecodeDisabled(this.panelPreferences.getPanelConnection().getCheckboxIsUrlDecodeDisabled().isSelected())
31
        .withIsNotTestingConnection(this.panelPreferences.getPanelConnection().getCheckboxIsNotTestingConnection().isSelected())
32
        .withIsNotProcessingCookies(this.panelPreferences.getPanelConnection().getCheckboxIsNotProcessingCookies().isSelected())
33
        .withIsProcessingCsrf(this.panelPreferences.getPanelConnection().getCheckboxIsProcessingCsrf().isSelected())
34
        .withIsLimitingThreads(this.panelPreferences.getPanelConnection().getCheckboxIsLimitingThreads().isSelected())
35
        .withCountLimitingThreads((Integer) this.panelPreferences.getPanelConnection().getSpinnerLimitingThreads().getValue())
36
        .withIsConnectionTimeout(this.panelPreferences.getPanelConnection().getCheckboxIsConnectionTimeout().isSelected())
37
        .withCountConnectionTimeout((Integer) this.panelPreferences.getPanelConnection().getSpinnerConnectionTimeout().getValue())
38
        .withIsCsrfUserTag(this.panelPreferences.getPanelConnection().getCheckboxIsCsrfUserTag().isSelected())
39
        .withCsrfUserTag(this.panelPreferences.getPanelConnection().getTextfieldCsrfUserTag().getText())
40
        .withCsrfUserTagOutput(this.panelPreferences.getPanelConnection().getTextfieldCsrfUserTagOutput().getText())
41
                
42
        .withIsParsingForm(this.panelPreferences.getPanelInjection().getCheckboxIsParsingForm().isSelected())
43
        .withIsNotInjectingMetadata(this.panelPreferences.getPanelInjection().getCheckboxIsNotInjectingMetadata().isSelected())
44
        .withIsNotSearchingCharInsertion(this.panelPreferences.getPanelInjection().getCheckboxIsNotSearchingCharInsertion().isSelected())
45
        .withIsNotShowingVulnReport(this.panelPreferences.getPanelInjection().getCheckboxIsNotShowingVulnReport().isSelected())
46
        .withIsLimitingUnionIndex(this.panelPreferences.getPanelInjection().getCheckboxIsLimitingUnionIndex().isSelected())
47
        .withCountUnionIndex((Integer) this.panelPreferences.getPanelInjection().getSpinnerUnionIndexCount().getValue())
48
        .withIsCheckingAllParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllParam().isSelected())
49
        .withIsCheckingAllURLParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllURLParam().isSelected())
50
        .withIsCheckingAllRequestParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllRequestParam().isSelected())
51
        .withIsCheckingAllHeaderParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllHeaderParam().isSelected())
52
        .withIsCheckingAllBase64Param(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllBase64Param().isSelected())
53
        .withIsCheckingAllJsonParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllJsonParam().isSelected())
54
        .withIsCheckingAllSoapParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllSoapParam().isSelected())
55
        .withIsCheckingAllCookieParam(this.panelPreferences.getPanelInjection().getCheckboxIsCheckingAllCookieParam().isSelected())
56
        .withIsDefaultStrategy(this.panelPreferences.getPanelInjection().getRadioIsDefaultStrategy().isSelected())
57
        .withIsZipStrategy(this.panelPreferences.getPanelInjection().getRadioIsZipStrategy().isSelected())
58
        .withIsDiosStrategy(this.panelPreferences.getPanelInjection().getRadioIsDiosStrategy().isSelected())
59
        .withIsUrlEncodingDisabled(this.panelPreferences.getPanelInjection().getCheckboxIsUrlEncodingDisabled().isSelected())
60
        .withIsUrlRandomSuffixDisabled(this.panelPreferences.getPanelInjection().getCheckboxIsUrlRandomSuffixDisabled().isSelected())
61
        .withIsPerfIndexDisabled(this.panelPreferences.getPanelInjection().getCheckboxIsPerfIndexDisabled().isSelected())
62
        .withIsLimitingSleepTimeStrategy(this.panelPreferences.getPanelInjection().getCheckboxIsLimitingSleepTimeStrategy().isSelected())
63
        .withCountSleepTimeStrategy((Integer) this.panelPreferences.getPanelInjection().getSpinnerSleepTimeStrategy().getValue())
64
                
65
        .withIsTamperingBase64(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingBase64().isSelected())
66
        .withIsTamperingEqualToLike(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEqualToLike().isSelected())
67
        .withIsTamperingFunctionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingFunctionComment().isSelected())
68
        .withIsTamperingVersionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingVersionComment().isSelected())
69
        .withIsTamperingRandomCase(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingRandomCase().isSelected())
70
        .withIsTamperingEval(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEval().isSelected())
71
        .withIsTamperingSpaceToDashComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToDashComment().isSelected())
72
        .withIsTamperingSpaceToMultilineComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToMultilineComment().isSelected())
73
        .withIsTamperingSpaceToSharpComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToSharpComment().isSelected())
74
        
75
        .withIsStrategyTimeDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyTimeDisabled().isSelected())
76
        .withIsStrategyBlindBitDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyBlindBitDisabled().isSelected())
77
        .withIsStrategyBlindBinDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyBlindBinDisabled().isSelected())
78
        .withIsStrategyMultibitDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyMultibitDisabled().isSelected())
79
        .withIsStrategyStackDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyStackDisabled().isSelected())
80
        .withIsStrategyErrorDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyErrorDisabled().isSelected())
81
        .withIsStrategyUnionDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyUnionDisabled().isSelected())
82
83
        .withIsUserAgentRandom(this.panelPreferences.getPanelUserAgent().getCheckboxIsCustomUserAgent().isSelected())
84
85 1 1. actionPerformed : removed call to com/jsql/util/PreferencesUtil::persist → NO_COVERAGE
        .persist();
86
        
87 1 1. actionPerformed : removed call to com/jsql/util/ProxyUtil::setPreferences → NO_COVERAGE
        MediatorHelper.model().getMediatorUtils().getProxyUtil().setPreferences(
88
            this.panelPreferences.getPanelProxy().getCheckboxIsUsingProxy().isSelected(),
89
            this.panelPreferences.getPanelProxy().getTextProxyAddress().getText(),
90
            this.panelPreferences.getPanelProxy().getTextProxyPort().getText(),
91
            this.panelPreferences.getPanelProxy().getCheckboxIsUsingProxyHttps().isSelected(),
92
            this.panelPreferences.getPanelProxy().getTextProxyAddressHttps().getText(),
93
            this.panelPreferences.getPanelProxy().getTextProxyPortHttps().getText()
94
        );
95
        
96
        MediatorHelper.model().getMediatorUtils().getTamperingUtil()  // unused
97
        .withBase64(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingBase64().isSelected())
98
        .withEqualToLike(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEqualToLike().isSelected())
99
        .withEval(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEval().isSelected())
100
        .withFunctionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingFunctionComment().isSelected())
101
        .withHexToChar(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingHexToChar().isSelected())
102
        .withQuoteToUtf8(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingQuoteToUtf8().isSelected())
103
        .withRandomCase(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingRandomCase().isSelected())
104
        .withSpaceToDashComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToDashComment().isSelected())
105
        .withSpaceToMultilineComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToMultilineComment().isSelected())
106
        .withSpaceToSharpComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToSharpComment().isSelected())
107
        .withStringToChar(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingStringToChar().isSelected())
108
        .withVersionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingVersionComment().isSelected());
109
        
110
        boolean isRestartRequired = MediatorHelper.model().getMediatorUtils().getAuthenticationUtil().set(
111
            this.panelPreferences.getPanelAuthentication().getCheckboxUseDigestAuthentication().isSelected(),
112
            this.panelPreferences.getPanelAuthentication().getTextDigestAuthenticationUsername().getText(),
113
            this.panelPreferences.getPanelAuthentication().getTextDigestAuthenticationPassword().getText(),
114
            this.panelPreferences.getPanelAuthentication().getCheckboxUseKerberos().isSelected(),
115
            this.panelPreferences.getPanelAuthentication().getTextKerberosKrb5Conf().getText(),
116
            this.panelPreferences.getPanelAuthentication().getTextKerberosLoginConf().getText()
117
        );
118
        
119 1 1. actionPerformed : negated conditional → NO_COVERAGE
        if (
120
            isRestartRequired
121 1 1. actionPerformed : negated conditional → NO_COVERAGE
            && JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(
122
                MediatorHelper.frame(),
123
                "File krb5.conf has changed, please restart.",
124
                "Restart",
125
                JOptionPane.YES_NO_OPTION
126
            )
127
        ) {
128 1 1. actionPerformed : removed call to com/jsql/view/swing/action/ActionNewWindow::actionPerformed → NO_COVERAGE
            new ActionNewWindow().actionPerformed(null);
129
        }
130
    }
131
}

Mutations

85

1.1
Location : actionPerformed
Killed by : none
removed call to com/jsql/util/PreferencesUtil::persist → NO_COVERAGE

87

1.1
Location : actionPerformed
Killed by : none
removed call to com/jsql/util/ProxyUtil::setPreferences → NO_COVERAGE

119

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

121

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

128

1.1
Location : actionPerformed
Killed by : none
removed call to com/jsql/view/swing/action/ActionNewWindow::actionPerformed → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.19.1