1 | package com.jsql.view.swing.panel.preferences; | |
2 | ||
3 | import com.jsql.util.LogLevelUtil; | |
4 | import com.jsql.util.StringUtil; | |
5 | import com.jsql.view.swing.text.SyntaxTextArea; | |
6 | import com.jsql.view.swing.text.listener.DocumentListenerEditing; | |
7 | import com.jsql.view.swing.util.MediatorHelper; | |
8 | import com.jsql.view.swing.util.UiUtil; | |
9 | import org.fife.ui.rsyntaxtextarea.SyntaxConstants; | |
10 | import org.fife.ui.rtextarea.RTextScrollPane; | |
11 | import org.yaml.snakeyaml.parser.ParserException; | |
12 | import org.yaml.snakeyaml.scanner.ScannerException; | |
13 | ||
14 | import javax.swing.*; | |
15 | ||
16 | public class PanelExploit extends JPanel { | |
17 | ||
18 | private static final SyntaxTextArea textfieldReverseList = new SyntaxTextArea("Reverse shell list"); | |
19 | private static final String TITLE = "Reverse shell server (connector)"; | |
20 | private static final String PATTERN = "<html><b>%s</b></html>"; | |
21 | ||
22 | public PanelExploit() { | |
23 |
1
1. <init> : removed call to com/jsql/view/swing/text/SyntaxTextArea::setSyntaxEditingStyle → NO_COVERAGE |
PanelExploit.textfieldReverseList.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_YAML); |
24 |
1
1. <init> : removed call to com/jsql/view/swing/panel/preferences/PanelExploit::applyTheme → NO_COVERAGE |
PanelExploit.applyTheme(); |
25 | ||
26 | var preferencesUtil = MediatorHelper.model().getMediatorUtils().getPreferencesUtil(); | |
27 | var labelOrigin = new JLabel(String.format(PanelExploit.PATTERN, PanelExploit.TITLE)); | |
28 |
1
1. <init> : removed call to javax/swing/text/Document::addDocumentListener → NO_COVERAGE |
PanelExploit.textfieldReverseList.getDocument().addDocumentListener(new DocumentListenerEditing() { |
29 | @Override | |
30 | public void process() { | |
31 | try { | |
32 |
1
1. process : removed call to com/jsql/util/PreferencesUtil::parseReverseCommands → NO_COVERAGE |
preferencesUtil.parseReverseCommands(PanelExploit.textfieldReverseList.getText()); |
33 |
1
1. process : removed call to javax/swing/JLabel::setText → NO_COVERAGE |
labelOrigin.setText(String.format(PanelExploit.PATTERN, PanelExploit.TITLE)); |
34 | } catch ( | |
35 | ParserException | ScannerException // yml | |
36 | | NullPointerException // map missing key | |
37 | | ClassCastException // incorrect model | |
38 | e | |
39 | ) { | |
40 |
1
1. process : removed call to javax/swing/JLabel::setText → NO_COVERAGE |
labelOrigin.setText(String.format(PanelExploit.PATTERN, StringUtil.formatReport( |
41 | LogLevelUtil.COLOR_RED, | |
42 | PanelExploit.TITLE | |
43 | + ", YAML must follow the name and command template :<br>" | |
44 | // Fix #96073: NullPointerException on e.getMessage().replace() | |
45 | + e.toString().replace("\n", "<br>") // toString to prevent NPE (jdk11) | |
46 | ))); | |
47 | } | |
48 | } | |
49 | }); | |
50 |
1
1. <init> : removed call to com/jsql/view/swing/text/SyntaxTextArea::setText → NO_COVERAGE |
PanelExploit.textfieldReverseList.setText( |
51 | preferencesUtil.getCommandsReverseYaml().replace("\r\n", "\n") // required to prevent \ra\n issue | |
52 | ); | |
53 | ||
54 | var scrollPane = new RTextScrollPane(PanelExploit.textfieldReverseList); | |
55 | ||
56 |
1
1. <init> : removed call to javax/swing/JLabel::setBorder → NO_COVERAGE |
labelOrigin.setBorder(PanelGeneral.MARGIN); |
57 | ||
58 | var groupLayout = new GroupLayout(this); | |
59 |
1
1. <init> : removed call to com/jsql/view/swing/panel/preferences/PanelExploit::setLayout → NO_COVERAGE |
this.setLayout(groupLayout); |
60 | ||
61 |
1
1. <init> : removed call to javax/swing/GroupLayout::setHorizontalGroup → NO_COVERAGE |
groupLayout.setHorizontalGroup( |
62 | groupLayout | |
63 | .createSequentialGroup() | |
64 | .addGroup( | |
65 | groupLayout | |
66 | .createParallelGroup(GroupLayout.Alignment.LEADING) | |
67 | .addComponent(labelOrigin) | |
68 | .addComponent(scrollPane) | |
69 | ) | |
70 | ); | |
71 | ||
72 |
1
1. <init> : removed call to javax/swing/GroupLayout::setVerticalGroup → NO_COVERAGE |
groupLayout.setVerticalGroup( |
73 | groupLayout | |
74 | .createSequentialGroup() | |
75 | .addGroup( | |
76 | groupLayout | |
77 | .createParallelGroup(GroupLayout.Alignment.BASELINE) | |
78 | .addComponent(labelOrigin) | |
79 | ) | |
80 | .addGroup( | |
81 | groupLayout | |
82 | .createParallelGroup(GroupLayout.Alignment.BASELINE) | |
83 | .addComponent(scrollPane) | |
84 | ) | |
85 | ); | |
86 | } | |
87 | ||
88 | public static void applyTheme() { | |
89 |
1
1. applyTheme : removed call to com/jsql/view/swing/util/UiUtil::applySyntaxTheme → NO_COVERAGE |
UiUtil.applySyntaxTheme(PanelExploit.textfieldReverseList); |
90 | } | |
91 | } | |
Mutations | ||
23 |
1.1 |
|
24 |
1.1 |
|
28 |
1.1 |
|
32 |
1.1 |
|
33 |
1.1 |
|
40 |
1.1 |
|
50 |
1.1 |
|
56 |
1.1 |
|
59 |
1.1 |
|
61 |
1.1 |
|
72 |
1.1 |
|
89 |
1.1 |