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().preferencesUtil()
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
        .withDnsDomain(this.panelPreferences.getPanelInjection().getTextfieldDnsDomain().getText())
65
        .withDnsPort(this.panelPreferences.getPanelInjection().getTextfieldDnsPort().getText())
66
67
        .withIsTamperingBase64(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingBase64().isSelected())
68
        .withIsTamperingEqualToLike(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEqualToLike().isSelected())
69
        .withIsTamperingFunctionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingFunctionComment().isSelected())
70
        .withIsTamperingVersionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingVersionComment().isSelected())
71
        .withIsTamperingRandomCase(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingRandomCase().isSelected())
72
        .withIsTamperingEval(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEval().isSelected())
73
        .withIsTamperingSpaceToDashComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToDashComment().isSelected())
74
        .withIsTamperingSpaceToMultilineComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToMultilineComment().isSelected())
75
        .withIsTamperingSpaceToSharpComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToSharpComment().isSelected())
76
        
77
        .withIsStrategyTimeDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyTimeDisabled().isSelected())
78
        .withIsStrategyBlindBitDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyBlindBitDisabled().isSelected())
79
        .withIsStrategyBlindBinDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyBlindBinDisabled().isSelected())
80
        .withIsStrategyMultibitDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyMultibitDisabled().isSelected())
81
        .withIsStrategyStackDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyStackDisabled().isSelected())
82
        .withIsStrategyDnsDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyDnsDisabled().isSelected())
83
        .withIsStrategyErrorDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyErrorDisabled().isSelected())
84
        .withIsStrategyUnionDisabled(this.panelPreferences.getPanelStrategies().getCheckboxIsStrategyUnionDisabled().isSelected())
85
86
        .withIsUserAgentRandom(this.panelPreferences.getPanelUserAgent().getCheckboxIsCustomUserAgent().isSelected())
87
88 1 1. actionPerformed : removed call to com/jsql/util/PreferencesUtil::persist → NO_COVERAGE
        .persist();
89
        
90 1 1. actionPerformed : removed call to com/jsql/util/ProxyUtil::setPreferences → NO_COVERAGE
        MediatorHelper.model().getMediatorUtils().proxyUtil().setPreferences(
91
            this.panelPreferences.getPanelProxy().getCheckboxIsUsingProxy().isSelected(),
92
            this.panelPreferences.getPanelProxy().getTextProxyAddress().getText(),
93
            this.panelPreferences.getPanelProxy().getTextProxyPort().getText(),
94
            this.panelPreferences.getPanelProxy().getCheckboxIsUsingProxyHttps().isSelected(),
95
            this.panelPreferences.getPanelProxy().getTextProxyAddressHttps().getText(),
96
            this.panelPreferences.getPanelProxy().getTextProxyPortHttps().getText()
97
        );
98
        
99
        MediatorHelper.model().getMediatorUtils().tamperingUtil()  // unused
100
        .withBase64(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingBase64().isSelected())
101
        .withEqualToLike(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEqualToLike().isSelected())
102
        .withEval(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingEval().isSelected())
103
        .withFunctionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingFunctionComment().isSelected())
104
        .withHexToChar(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingHexToChar().isSelected())
105
        .withQuoteToUtf8(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingQuoteToUtf8().isSelected())
106
        .withCharToEncoding(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingCharToEncoding().isSelected())
107
        .withRandomCase(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingRandomCase().isSelected())
108
        .withSpaceToDashComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToDashComment().isSelected())
109
        .withSpaceToMultilineComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToMultilineComment().isSelected())
110
        .withSpaceToSharpComment(this.panelPreferences.getPanelTampering().getRadioIsTamperingSpaceToSharpComment().isSelected())
111
        .withStringToChar(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingStringToChar().isSelected())
112
        .withVersionComment(this.panelPreferences.getPanelTampering().getCheckboxIsTamperingVersionComment().isSelected());
113
        
114
        boolean isRestartRequired = MediatorHelper.model().getMediatorUtils().authenticationUtil().set(
115
            this.panelPreferences.getPanelAuthentication().getCheckboxUseDigestAuthentication().isSelected(),
116
            this.panelPreferences.getPanelAuthentication().getTextDigestAuthenticationUsername().getText(),
117
            this.panelPreferences.getPanelAuthentication().getTextDigestAuthenticationPassword().getText(),
118
            this.panelPreferences.getPanelAuthentication().getCheckboxUseKerberos().isSelected(),
119
            this.panelPreferences.getPanelAuthentication().getTextKerberosKrb5Conf().getText(),
120
            this.panelPreferences.getPanelAuthentication().getTextKerberosLoginConf().getText()
121
        );
122
        
123 1 1. actionPerformed : negated conditional → NO_COVERAGE
        if (
124
            isRestartRequired
125 1 1. actionPerformed : negated conditional → NO_COVERAGE
            && JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(
126
                MediatorHelper.frame(),
127
                "File krb5.conf has changed, please restart.",
128
                "Restart",
129
                JOptionPane.YES_NO_OPTION
130
            )
131
        ) {
132 1 1. actionPerformed : removed call to com/jsql/view/swing/action/ActionNewWindow::actionPerformed → NO_COVERAGE
            new ActionNewWindow().actionPerformed(null);
133
        }
134
    }
135
}

Mutations

88

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

90

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

123

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

125

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

132

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.22.1