Compare commits

...

6 Commits
2.2.1 ... 2.2.3

Author SHA1 Message Date
AnonymousUser
15f84028bb Version: 2.2.3 Update 2022-05-12 11:00:55 +08:00
AnonymousUser
1238e536d1 Version: 2.2.2 Update 2022-05-04 23:17:24 +08:00
AnonymousUser
5d23a68c0e Version: 2.2.2 Update 2022-05-04 22:51:58 +08:00
AnonymousUser
d7f04526b4 Version: 2.2.2 Update 2022-05-04 22:48:44 +08:00
AnonymousUser
acff96ed7b Version: 2.2.2 Update 2022-05-04 22:47:28 +08:00
AnonymousUser
350c093162 Update 2022-05-04 20:50:53 +08:00
15 changed files with 303 additions and 298 deletions

View File

@@ -4,9 +4,13 @@
架构作者: [@0chencc](https://github.com/0Chencc) 架构作者: [@0chencc](https://github.com/0Chencc)
## 公共规则网站 ## 公共规则 & 打赏
https://gh0st.cn/HaE/ 公共规则下载地址:https://gh0st.cn/HaE/
如果你觉得HaE好用可以打赏一下作者给作者持续更新下去的动力
![](images/reward.jpeg)
## 介绍 ## 介绍

BIN
images/reward.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

View File

@@ -13,7 +13,7 @@ import java.util.List;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
/* /**
* @author EvilChen & 0chencc * @author EvilChen & 0chencc
*/ */
@@ -32,7 +32,7 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
this.callbacks = callbacks; this.callbacks = callbacks;
BurpExtender.helpers = callbacks.getHelpers(); BurpExtender.helpers = callbacks.getHelpers();
String version = "2.2.1"; String version = "2.2.3";
callbacks.setExtensionName(String.format("HaE (%s) - Highlighter and Extractor", version)); callbacks.setExtensionName(String.format("HaE (%s) - Highlighter and Extractor", version));
// 定义输出 // 定义输出
stdout = new PrintWriter(callbacks.getStdout(), true); stdout = new PrintWriter(callbacks.getStdout(), true);
@@ -61,7 +61,7 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
return main; return main;
} }
/* /**
* 使用processHttpMessage用来做Highlighter * 使用processHttpMessage用来做Highlighter
*/ */
@Override @Override
@@ -149,6 +149,9 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
return false; return false;
} }
/**
* 快捷键复制功能
*/
@Override @Override
public byte[] getSelectedData() { public byte[] getSelectedData() {
int[] selectRows = jTable.getSelectedRows(); int[] selectRows = jTable.getSelectedRows();
@@ -156,10 +159,13 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
for (int row : selectRows) { for (int row : selectRows) {
selectData.append(jTable.getValueAt(row, 0).toString()).append("\n"); selectData.append(jTable.getValueAt(row, 0).toString()).append("\n");
} }
return helpers.stringToBytes(selectData.toString()); // 便于单行复制,去除最后一个换行符
String revData = selectData.reverse().toString().replaceFirst("\n", "");
StringBuilder retData = new StringBuilder(revData).reverse();
return helpers.stringToBytes(retData.toString());
} }
/* /**
* 使用setMessage用来做Extractor * 使用setMessage用来做Extractor
*/ */
@Override @Override
@@ -172,18 +178,25 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
makeTable(extractResponseMap); makeTable(extractResponseMap);
} }
} }
} }
/**
* 创建MarkInfo表单
*/
public void makeTable(Map<String, String> dataMap) { public void makeTable(Map<String, String> dataMap) {
this.jTabbedPane.removeAll();
dataMap.keySet().forEach(i->{ dataMap.keySet().forEach(i->{
String[] extractData = dataMap.get(i).split("\n"); String[] extractData = dataMap.get(i).split("\n");
Object[][] data = new Object[extractData.length][1]; Object[][] data = new Object[extractData.length][1];
for (int x = 0; x < extractData.length; x++) { for (int x = 0; x < extractData.length; x++) {
data[x][0] = extractData[x]; data[x][0] = extractData[x];
} }
this.jTabbedPane.addTab(i, new JScrollPane(new JTable(data, new Object[] {"Information"}))); int indexOfTab = this.jTabbedPane.indexOfTab(i);
JScrollPane jScrollPane = new JScrollPane(new JTable(data, new Object[] {"Information"}));
this.jTabbedPane.addTab(i, jScrollPane);
// 使用removeAll会导致UI出现空白的情况为了改善用户侧体验采用remove的方式进行删除
if (indexOfTab != -1) {
this.jTabbedPane.remove(indexOfTab);
}
}); });
} }
} }

View File

@@ -1,10 +1,9 @@
package burp; package burp;
/* /**
* @author EvilChen * @author EvilChen
*/ */
import burp.yaml.LoadConfig;
import java.util.Map; import java.util.Map;
public class Config { public class Config {
@@ -25,7 +24,6 @@ public class Config {
"dfa" "dfa"
}; };
public static String[] colorArray = new String[] { public static String[] colorArray = new String[] {
"red", "red",
"orange", "orange",

View File

@@ -6,7 +6,7 @@ import burp.Config;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/* /**
* @author EvilChen * @author EvilChen
*/ */

View File

@@ -12,7 +12,7 @@ import dk.brics.automaton.RunAutomaton;
import jregex.Matcher; import jregex.Matcher;
import jregex.Pattern; import jregex.Pattern;
/* /**
* @author EvilChen * @author EvilChen
*/ */

View File

@@ -4,12 +4,12 @@ import burp.Config;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/* /**
* @author EvilChen * @author EvilChen
*/ */
public class GetColorKey { public class GetColorKey {
/* /**
* 颜色下标获取 * 颜色下标获取
*/ */
public List<Integer> getColorKeys(List<String> keys){ public List<Integer> getColorKeys(List<String> keys){

View File

@@ -5,7 +5,7 @@ import jregex.Pattern;
import jregex.REFlags; import jregex.REFlags;
import burp.yaml.LoadConfig; import burp.yaml.LoadConfig;
/* /**
* @author EvilChen * @author EvilChen
*/ */

View File

@@ -4,13 +4,13 @@ import burp.Config;
import java.util.*; import java.util.*;
/* /**
* @author EvilChen * @author EvilChen
*/ */
public class UpgradeColor { public class UpgradeColor {
private String endColor = ""; private String endColor = "";
/* /**
* 颜色升级递归算法 * 颜色升级递归算法
*/ */
private void colorUpgrade(List<Integer> colorList) { private void colorUpgrade(List<Integer> colorList) {

View File

@@ -6,7 +6,7 @@ import java.awt.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
/* /**
* @author 6dc * @author 6dc
* *
* A class which creates a JTabbedPane and auto sets a close button when you add a tab * A class which creates a JTabbedPane and auto sets a close button when you add a tab
@@ -18,7 +18,7 @@ public class JTabbedPaneCloseButton extends JTabbedPane {
super(); super();
} }
/* Override Addtab in order to add the close Button everytime */ /** Override Addtab in order to add the close Button everytime */
@Override @Override
public void addTab(String title, Icon icon, Component component, String tip) { public void addTab(String title, Icon icon, Component component, String tip) {
super.addTab(title, icon, component, tip); super.addTab(title, icon, component, tip);
@@ -45,7 +45,7 @@ public class JTabbedPaneCloseButton extends JTabbedPane {
} }
} }
/* addTabNoExit */ /** addTabNoExit */
public void addTabNoExit(String title, Icon icon, Component component, String tip) { public void addTabNoExit(String title, Icon icon, Component component, String tip) {
super.addTab(title, icon, component, tip); super.addTab(title, icon, component, tip);
} }
@@ -58,7 +58,7 @@ public class JTabbedPaneCloseButton extends JTabbedPane {
addTabNoExit(title, null, component); addTabNoExit(title, null, component);
} }
/* Button */ /** Button */
public class CloseButtonTab extends JPanel { public class CloseButtonTab extends JPanel {
public CloseButtonTab(final Component tab, String title, Icon icon) { public CloseButtonTab(final Component tab, String title, Icon icon) {
@@ -74,7 +74,7 @@ public class JTabbedPaneCloseButton extends JTabbedPane {
add(button); add(button);
} }
} }
/* ClickListener */ /** ClickListener */
public class CloseListener implements MouseListener public class CloseListener implements MouseListener
{ {
private final Component tab; private final Component tab;

View File

@@ -14,7 +14,7 @@ import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.util.Map; import java.util.Map;
/* /**
* @author LinChen * @author LinChen
*/ */
@@ -24,23 +24,24 @@ public class MainUI extends JPanel{
public MainUI() { public MainUI() {
initComponents(); initComponents();
} }
public void closeTabActionPerformed(ActionEvent e){ public void closeTabActionPerformed(ActionEvent e){
if (tabbedPane1.getTabCount()>2){ if (ruleTabbedPane.getTabCount()>2){
if (tabbedPane1.getSelectedIndex()!=0){ if (ruleTabbedPane.getSelectedIndex()!=0){
SetConfig setConn = new SetConfig(); SetConfig setConn = new SetConfig();
setConn.deleteRules(tabbedPane1.getTitleAt(tabbedPane1.getSelectedIndex())); setConn.deleteRules(ruleTabbedPane.getTitleAt(ruleTabbedPane.getSelectedIndex()));
tabbedPane1.remove(tabbedPane1.getSelectedIndex()); ruleTabbedPane.remove(ruleTabbedPane.getSelectedIndex());
tabbedPane1.setSelectedIndex(tabbedPane1.getSelectedIndex()-1); ruleTabbedPane.setSelectedIndex(ruleTabbedPane.getSelectedIndex()-1);
}else{ }else{
SetConfig setConn = new SetConfig(); SetConfig setConn = new SetConfig();
setConn.deleteRules(tabbedPane1.getTitleAt(tabbedPane1.getSelectedIndex())); setConn.deleteRules(ruleTabbedPane.getTitleAt(ruleTabbedPane.getSelectedIndex()));
tabbedPane1.remove(tabbedPane1.getSelectedIndex()); ruleTabbedPane.remove(ruleTabbedPane.getSelectedIndex());
tabbedPane1.setSelectedIndex(tabbedPane1.getSelectedIndex()); ruleTabbedPane.setSelectedIndex(ruleTabbedPane.getSelectedIndex());
} }
} }
} }
private void SelectFileMouseClicked(MouseEvent e) { private void selectFileMouseClicked(MouseEvent e) {
JFileChooser selectFile = new JFileChooser(); JFileChooser selectFile = new JFileChooser();
selectFile.setFileSelectionMode(JFileChooser.FILES_ONLY); selectFile.setFileSelectionMode(JFileChooser.FILES_ONLY);
FileNameExtensionFilter filter = new FileNameExtensionFilter("Yaml File (.yml/.yaml)","yaml", "yml"); FileNameExtensionFilter filter = new FileNameExtensionFilter("Yaml File (.yml/.yaml)","yaml", "yml");
@@ -50,21 +51,22 @@ public class MainUI extends JPanel{
String configPath = selectFile.getSelectedFile().toString(); String configPath = selectFile.getSelectedFile().toString();
reloadRule(); reloadRule();
loadConn.setConfigPath(configPath); loadConn.setConfigPath(configPath);
configFilepathtext.setText(configPath); configTextField.setText(configPath);
} }
new LoadConfig();
} }
private void reloadRule(){ private void reloadRule(){
tabbedPane1.removeAll(); ruleTabbedPane.removeAll();
ruleSwitch.setListen(false); ruleSwitch.setListen(false);
Map<String,Object[][]> rules = LoadConfig.getRules(); Map<String,Object[][]> rules = LoadConfig.getRules();
rules.keySet().forEach( rules.keySet().forEach(
i->tabbedPane1.addTab( i-> ruleTabbedPane.addTab(
i, i,
new RulePane(rules.get(i), tabbedPane1) new RulePane(rules.get(i), ruleTabbedPane)
) )
); );
tabbedPane1.addTab("...", new JLabel()); ruleTabbedPane.addTab("...", new JLabel());
ruleSwitch.setListen(true); ruleSwitch.setListen(true);
} }
@@ -72,205 +74,199 @@ public class MainUI extends JPanel{
reloadRule(); reloadRule();
} }
private void ESSaveMouseClicked(MouseEvent e) { private void excludeSuffixSaveMouseClicked(MouseEvent e) {
LoadConfig loadCon = new LoadConfig(); LoadConfig loadCon = new LoadConfig();
loadCon.setExcludeSuffix(EStext.getText()); loadCon.setExcludeSuffix(excludeSuffixTextField.getText());
} }
private void initComponents() { private void initComponents() {
tabbedPane2 = new JTabbedPane(); rulesTabbedPane = new JTabbedPane();
tabbedPane1 = new JTabbedPane(); ruleTabbedPane = new JTabbedPane();
panel3 = new JPanel(); rulePanel = new JPanel();
configFilepathtext = new JTextField(); configTextField = new JTextField();
label1 = new JLabel(); configLabel = new JLabel();
SelectFile = new JButton(); selectFileButton = new JButton();
reload = new JButton(); reloadButton = new JButton();
label2 = new JLabel(); excludeSuffixLabel = new JLabel();
EStext = new JTextField(); excludeSuffixTextField = new JTextField();
ESSave = new JButton(); excludeSuffixSaveButton = new JButton();
//======== this ========
setLayout(new GridBagLayout()); setLayout(new GridBagLayout());
((GridBagLayout)getLayout()).columnWidths = new int[] {0, 0}; ((GridBagLayout)getLayout()).columnWidths = new int[] {0, 0};
((GridBagLayout)getLayout()).rowHeights = new int[] {0, 0}; ((GridBagLayout)getLayout()).rowHeights = new int[] {0, 0};
((GridBagLayout)getLayout()).columnWeights = new double[] {1.0, 1.0E-4}; ((GridBagLayout)getLayout()).columnWeights = new double[] {1.0, 1.0E-4};
((GridBagLayout)getLayout()).rowWeights = new double[] {1.0, 1.0E-4}; ((GridBagLayout)getLayout()).rowWeights = new double[] {1.0, 1.0E-4};
//======== tabbedPane2 ========
{ {
tabbedPane2.addTab("Rules", tabbedPane1); rulesTabbedPane.addTab("Rules", ruleTabbedPane);
//======== panel3 ========
{ {
panel3.setLayout(new GridBagLayout()); rulePanel.setLayout(new GridBagLayout());
((GridBagLayout)panel3.getLayout()).columnWidths = new int[] {0, 0, 0, 0, 0}; ((GridBagLayout) rulePanel.getLayout()).columnWidths = new int[] {0, 0, 0, 0, 0};
((GridBagLayout)panel3.getLayout()).rowHeights = new int[] {0, 0, 0}; ((GridBagLayout) rulePanel.getLayout()).rowHeights = new int[] {0, 0, 0};
((GridBagLayout)panel3.getLayout()).columnWeights = new double[] {0.0, 1.0, 0.0, 0.0, 1.0E-4}; ((GridBagLayout) rulePanel.getLayout()).columnWeights = new double[] {0.0, 1.0, 0.0, 0.0, 1.0E-4};
((GridBagLayout)panel3.getLayout()).rowWeights = new double[] {0.0, 0.0, 1.0E-4}; ((GridBagLayout) rulePanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 1.0E-4};
//---- configFilepathtext ---- configTextField.setEditable(false);
configFilepathtext.setEditable(false); rulePanel.add(configTextField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
panel3.add(configFilepathtext, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(5, 0, 5, 5), 0, 0)); new Insets(5, 0, 5, 5), 0, 0));
//---- label1 ---- configLabel.setText("Config File Path:");
label1.setText("Config File Path:"); rulePanel.add(configLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
panel3.add(label1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.VERTICAL, GridBagConstraints.WEST, GridBagConstraints.VERTICAL,
new Insets(5, 5, 5, 5), 0, 0)); new Insets(5, 5, 5, 5), 0, 0));
//---- SelectFile ---- selectFileButton.setText("Select File ...");
SelectFile.setText("Select File ..."); selectFileButton.addMouseListener(new MouseAdapter() {
SelectFile.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
SelectFileMouseClicked(e); selectFileMouseClicked(e);
} }
}); });
panel3.add(SelectFile, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, rulePanel.add(selectFileButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(5, 0, 5, 5), 0, 0)); new Insets(5, 0, 5, 5), 0, 0));
//---- reload ---- reloadButton.setText("Reload");
reload.setText("Reload"); reloadButton.addMouseListener(new MouseAdapter() {
reload.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
reloadMouseClicked(e); reloadMouseClicked(e);
} }
}); });
panel3.add(reload, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, rulePanel.add(reloadButton, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(5, 0, 5, 5), 0, 0)); new Insets(5, 0, 5, 5), 0, 0));
//---- label2 ----
label2.setText("ExcludeSuffix:"); excludeSuffixLabel.setText("ExcludeSuffix:");
panel3.add(label2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, rulePanel.add(excludeSuffixLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE,
new Insets(0, 5, 5, 5), 0, 0)); new Insets(0, 5, 5, 5), 0, 0));
panel3.add(EStext, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, rulePanel.add(excludeSuffixTextField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 5), 0, 0)); new Insets(0, 0, 0, 5), 0, 0));
//---- ESSave ---- excludeSuffixSaveButton.setText("Save");
ESSave.setText("Save"); excludeSuffixSaveButton.addMouseListener(new MouseAdapter() {
ESSave.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
ESSaveMouseClicked(e); excludeSuffixSaveMouseClicked(e);
} }
}); });
panel3.add(ESSave, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, rulePanel.add(excludeSuffixSaveButton, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 5), 0, 0)); new Insets(0, 0, 0, 5), 0, 0));
} }
tabbedPane2.addTab("Config", panel3); rulesTabbedPane.addTab("Config", rulePanel);
} }
add(tabbedPane2, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, add(rulesTabbedPane, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 0, 0, 0), 0, 0)); new Insets(0, 0, 0, 0), 0, 0));
// JFormDesigner - End of component initialization //GEN-END:initComponents
Config.ruleConfig.keySet().forEach(i->tabbedPane1.addTab(i,new RulePane(Config.ruleConfig.get(i),tabbedPane1))); Config.ruleConfig.keySet().forEach(i-> ruleTabbedPane.addTab(i,new RulePane(Config.ruleConfig.get(i),
ruleTabbedPane)));
tabbedPane1.addTab("...",new JLabel()); ruleTabbedPane.addTab("...",new JLabel());
//TabTitleEditListener ruleSwitch = new TabTitleEditListener(tabbedPane1); configTextField.setText(LoadConfig.getConfigPath());
configFilepathtext.setText(LoadConfig.getConfigPath()); excludeSuffixTextField.setText(loadConn.getExcludeSuffix());
EStext.setText(loadConn.getExcludeSuffix()); ruleSwitch = new TabTitleEditListener(ruleTabbedPane);
ruleSwitch = new TabTitleEditListener(tabbedPane1); ruleTabbedPane.addChangeListener(ruleSwitch);
tabbedPane1.addChangeListener(ruleSwitch); ruleTabbedPane.addMouseListener(ruleSwitch);
tabbedPane1.addMouseListener(ruleSwitch); closeTabMenuItem.addActionListener(e -> closeTabActionPerformed(e));
closeTab.addActionListener(e -> closeTabActionPerformed(e)); tabMenu.add(closeTabMenuItem);
tabMenu.add(closeTab);
} }
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private JTabbedPane rulesTabbedPane;
private JTabbedPane tabbedPane2; private JTabbedPane ruleTabbedPane;
private JTabbedPane tabbedPane1; private JPanel rulePanel;
private JPanel panel3; private JTextField configTextField;
private JTextField configFilepathtext; private JLabel configLabel;
private JLabel label1; private JButton selectFileButton;
private JButton SelectFile; private JButton reloadButton;
private JButton reload; private JLabel excludeSuffixLabel;
private JLabel label2; private JTextField excludeSuffixTextField;
private JTextField EStext; private JButton excludeSuffixSaveButton;
private JButton ESSave;
// JFormDesigner - End of variables declaration //GEN-END:variables
protected static JPopupMenu tabMenu = new JPopupMenu(); protected static JPopupMenu tabMenu = new JPopupMenu();
private JMenuItem closeTab = new JMenuItem("Delete"); private JMenuItem closeTabMenuItem = new JMenuItem("Delete");
private TabTitleEditListener ruleSwitch; private TabTitleEditListener ruleSwitch;
} }
class TabTitleEditListener extends MouseAdapter implements ChangeListener, DocumentListener { class TabTitleEditListener extends MouseAdapter implements ChangeListener, DocumentListener {
protected final JTextField editor = new JTextField(); protected final JTextField ruleEditTextField = new JTextField();
protected final JTabbedPane tabbedPane; protected final JTabbedPane ruleEditTabbedPane;
protected int editingIdx = -1; protected int editingIndex = -1;
protected int len = -1; protected int len = -1;
protected Boolean listen = true; protected Boolean listen = true;
protected Dimension dim; protected Dimension dim;
protected Component tabComponent; protected Component tabComponent;
protected Boolean isRenameOk = false; protected Boolean isRenameOk = false;
protected SetConfig setConfig = new SetConfig(); protected SetConfig setConfig = new SetConfig();
protected final Action startEditing = new AbstractAction() { protected final Action startEditing = new AbstractAction() {
@Override public void actionPerformed(ActionEvent e) { @Override public void actionPerformed(ActionEvent e) {
editingIdx = tabbedPane.getSelectedIndex(); editingIndex = ruleEditTabbedPane.getSelectedIndex();
tabComponent = tabbedPane.getTabComponentAt(editingIdx); tabComponent = ruleEditTabbedPane.getTabComponentAt(editingIndex);
tabbedPane.setTabComponentAt(editingIdx, editor); ruleEditTabbedPane.setTabComponentAt(editingIndex, ruleEditTextField);
isRenameOk = true; isRenameOk = true;
editor.setVisible(true); ruleEditTextField.setVisible(true);
editor.setText(tabbedPane.getTitleAt(editingIdx)); ruleEditTextField.setText(ruleEditTabbedPane.getTitleAt(editingIndex));
editor.selectAll(); ruleEditTextField.selectAll();
editor.requestFocusInWindow(); ruleEditTextField.requestFocusInWindow();
len = editor.getText().length(); len = ruleEditTextField.getText().length();
dim = editor.getPreferredSize(); dim = ruleEditTextField.getPreferredSize();
editor.setMinimumSize(dim); ruleEditTextField.setMinimumSize(dim);
} }
}; };
protected final Action renameTabTitle = new AbstractAction() { protected final Action renameTabTitle = new AbstractAction() {
@Override public void actionPerformed(ActionEvent e) { @Override public void actionPerformed(ActionEvent e) {
String title = editor.getText().trim(); String title = ruleEditTextField.getText().trim();
if (editingIdx >= 0 && !title.isEmpty()) { if (editingIndex >= 0 && !title.isEmpty()) {
String oldName = tabbedPane.getTitleAt(editingIdx); String oldName = ruleEditTabbedPane.getTitleAt(editingIndex);
tabbedPane.setTitleAt(editingIdx, title); ruleEditTabbedPane.setTitleAt(editingIndex, title);
setConfig.rename(oldName,title); setConfig.rename(oldName,title);
} }
cancelEditing.actionPerformed(null); cancelEditing.actionPerformed(null);
} }
}; };
protected final Action cancelEditing = new AbstractAction() { protected final Action cancelEditing = new AbstractAction() {
@Override public void actionPerformed(ActionEvent e) { @Override public void actionPerformed(ActionEvent e) {
if (editingIdx >= 0) { if (editingIndex >= 0) {
tabbedPane.setTabComponentAt(editingIdx, tabComponent); ruleEditTabbedPane.setTabComponentAt(editingIndex, tabComponent);
editor.setVisible(false); ruleEditTextField.setVisible(false);
editingIdx = -1; editingIndex = -1;
len = -1; len = -1;
tabComponent = null; tabComponent = null;
editor.setPreferredSize(null); ruleEditTextField.setPreferredSize(null);
tabbedPane.requestFocusInWindow(); ruleEditTabbedPane.requestFocusInWindow();
} }
} }
}; };
protected TabTitleEditListener(JTabbedPane tabbedPane) { protected TabTitleEditListener(JTabbedPane tabbedPane) {
super(); super();
this.tabbedPane = tabbedPane; this.ruleEditTabbedPane = tabbedPane;
editor.setBorder(BorderFactory.createEmptyBorder()); ruleEditTextField.setBorder(BorderFactory.createEmptyBorder());
editor.addFocusListener(new FocusAdapter() { ruleEditTextField.addFocusListener(new FocusAdapter() {
@Override public void focusLost(FocusEvent e) { @Override public void focusLost(FocusEvent e) {
renameTabTitle.actionPerformed(null); renameTabTitle.actionPerformed(null);
} }
}); });
InputMap im = editor.getInputMap(JComponent.WHEN_FOCUSED); InputMap im = ruleEditTextField.getInputMap(JComponent.WHEN_FOCUSED);
ActionMap am = editor.getActionMap(); ActionMap am = ruleEditTextField.getActionMap();
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel-editing"); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel-editing");
am.put("cancel-editing", cancelEditing); am.put("cancel-editing", cancelEditing);
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "rename-tab-title"); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "rename-tab-title");
am.put("rename-tab-title", renameTabTitle); am.put("rename-tab-title", renameTabTitle);
editor.getDocument().addDocumentListener(this); ruleEditTextField.getDocument().addDocumentListener(this);
tabbedPane.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "start-editing"); tabbedPane.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "start-editing");
tabbedPane.getActionMap().put("start-editing", startEditing); tabbedPane.getActionMap().put("start-editing", startEditing);
} }
@Override public void stateChanged(ChangeEvent e) { @Override public void stateChanged(ChangeEvent e) {
if (e.getSource() instanceof JTabbedPane && listen) { if (e.getSource() instanceof JTabbedPane && listen) {
JTabbedPane pane = (JTabbedPane) e.getSource(); JTabbedPane pane = (JTabbedPane) e.getSource();
@@ -286,18 +282,22 @@ class TabTitleEditListener extends MouseAdapter implements ChangeListener, Docum
} }
renameTabTitle.actionPerformed(null); renameTabTitle.actionPerformed(null);
} }
public void newTab(){ public void newTab(){
Object[][] data = new Object[][]{{false, "New Name", "(New Regex)", "gray", "any", "nfa"}}; Object[][] data = new Object[][]{{false, "New Name", "(New Regex)", "gray", "any", "nfa"}};
insertTab(tabbedPane, setConfig.newRules(),data); insertTab(ruleEditTabbedPane, setConfig.newRules(),data);
} }
public void insertTab(JTabbedPane pane,String title,Object[][] data){ public void insertTab(JTabbedPane pane,String title,Object[][] data){
pane.addTab(title,new RulePane(data,pane)); pane.addTab(title,new RulePane(data,pane));
pane.remove(pane.getSelectedIndex()); pane.remove(pane.getSelectedIndex());
pane.addTab("...",new JLabel()); pane.addTab("...",new JLabel());
} }
public void setListen(Boolean listen){ public void setListen(Boolean listen){
this.listen = listen; this.listen = listen;
} }
@Override public void insertUpdate(DocumentEvent e) { @Override public void insertUpdate(DocumentEvent e) {
updateTabSize(); updateTabSize();
} }
@@ -312,7 +312,7 @@ class TabTitleEditListener extends MouseAdapter implements ChangeListener, Docum
switch (e.getButton()){ switch (e.getButton()){
case 1: case 1:
{ {
Rectangle r = tabbedPane.getBoundsAt(tabbedPane.getSelectedIndex()); Rectangle r = ruleEditTabbedPane.getBoundsAt(ruleEditTabbedPane.getSelectedIndex());
boolean isDoubleClick = e.getClickCount() >= 2; boolean isDoubleClick = e.getClickCount() >= 2;
if (isDoubleClick && r.contains(e.getPoint())) { if (isDoubleClick && r.contains(e.getPoint())) {
startEditing.actionPerformed(null); startEditing.actionPerformed(null);
@@ -331,7 +331,7 @@ class TabTitleEditListener extends MouseAdapter implements ChangeListener, Docum
} }
protected void updateTabSize() { protected void updateTabSize() {
editor.setPreferredSize(editor.getText().length() > len ? null : dim); ruleEditTextField.setPreferredSize(ruleEditTextField.getText().length() > len ? null : dim);
tabbedPane.revalidate(); ruleEditTabbedPane.revalidate();
} }
} }

View File

@@ -12,82 +12,83 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.Vector; import java.util.Vector;
/* /**
* @author LinChen * @author LinChen
*/ */
public class RulePane extends JPanel { public class RulePane extends JPanel {
public RulePane(Object[][] data,JTabbedPane pane) { public RulePane(Object[][] data, JTabbedPane pane) {
initComponents(data,pane); initComponents(data, pane);
} }
private SetConfig setruleconfig = new SetConfig(); private SetConfig setConfig = new SetConfig();
private Boolean isEdit = false; private Boolean isEdit = false;
private void RuleAddMouseClicked(MouseEvent e, JTabbedPane pane) {
private void ruleAddMouseClicked(MouseEvent e, JTabbedPane pane) {
RuleSetting add = new RuleSetting(); RuleSetting add = new RuleSetting();
int isOk = JOptionPane.showConfirmDialog(null,add,"RuleSetting - Add Rule",JOptionPane.OK_OPTION); int isOk = JOptionPane.showConfirmDialog(null, add, "RuleSetting - Add Rule", JOptionPane.OK_OPTION);
if(isOk == 0){ if(isOk == 0){
Vector data = new Vector(); Vector data = new Vector();
data.add(false); data.add(false);
data.add(add.Name.getText()); data.add(add.Name.getText());
data.add(add.Regex.getText()); data.add(add.regexTextField.getText());
data.add(add.ColorSelect.getSelectedItem().toString()); data.add(add.colorComboBox.getSelectedItem().toString());
data.add(add.ScopeSelect.getSelectedItem().toString()); data.add(add.scopeComboBox.getSelectedItem().toString());
data.add(add.EngineSelect.getSelectedItem().toString()); data.add(add.engineComboBox.getSelectedItem().toString());
model.insertRow(model.getRowCount(),data); model.insertRow(model.getRowCount(), data);
model = (DefaultTableModel) table.getModel(); model = (DefaultTableModel) ruleTable.getModel();
setruleconfig.add(data,pane.getTitleAt(pane.getSelectedIndex())); setConfig.add(data, pane.getTitleAt(pane.getSelectedIndex()));
} }
} }
private void RuleEditMouseClicked(MouseEvent e,JTabbedPane pane){ private void ruleEditMouseClicked(MouseEvent e, JTabbedPane pane){
if (table.getSelectedRowCount()>=1){ if (ruleTable.getSelectedRowCount() >= 1){
RuleSetting edit = new RuleSetting(); RuleSetting edit = new RuleSetting();
edit.Name.setText(table.getValueAt(table.getSelectedRow(),1).toString()); edit.Name.setText(ruleTable.getValueAt(ruleTable.getSelectedRow(), 1).toString());
edit.Regex.setText(table.getValueAt(table.getSelectedRow(),2).toString()); edit.regexTextField.setText(ruleTable.getValueAt(ruleTable.getSelectedRow(), 2).toString());
edit.ColorSelect.setSelectedItem(table.getValueAt(table.getSelectedRow(),3).toString()); edit.colorComboBox.setSelectedItem(ruleTable.getValueAt(ruleTable.getSelectedRow(), 3).toString());
edit.ScopeSelect.setSelectedItem(table.getValueAt(table.getSelectedRow(),4).toString()); edit.scopeComboBox.setSelectedItem(ruleTable.getValueAt(ruleTable.getSelectedRow(), 4).toString());
edit.EngineSelect.setSelectedItem(table.getValueAt(table.getSelectedRow(),5).toString()); edit.engineComboBox.setSelectedItem(ruleTable.getValueAt(ruleTable.getSelectedRow(), 5).toString());
int isOk = JOptionPane.showConfirmDialog(null,edit,"RuleSetting - Edit Rule",JOptionPane.OK_OPTION); int isOk = JOptionPane.showConfirmDialog(null, edit, "RuleSetting - Edit Rule", JOptionPane.OK_OPTION);
if (isOk ==0){ if (isOk == 0){
int select = table.convertRowIndexToModel(table.getSelectedRow()); int select = ruleTable.convertRowIndexToModel(ruleTable.getSelectedRow());
model.setValueAt(edit.Name.getText(),select,1); model.setValueAt(edit.Name.getText(), select, 1);
model.setValueAt(edit.Regex.getText(),select,2); model.setValueAt(edit.regexTextField.getText(), select, 2);
model.setValueAt(edit.ColorSelect.getSelectedItem().toString(),select,3); model.setValueAt(edit.colorComboBox.getSelectedItem().toString(), select, 3);
model.setValueAt(edit.ScopeSelect.getSelectedItem().toString(),select,4); model.setValueAt(edit.scopeComboBox.getSelectedItem().toString(), select, 4);
model.setValueAt(edit.EngineSelect.getSelectedItem().toString(),select,5); model.setValueAt(edit.engineComboBox.getSelectedItem().toString(), select, 5);
model = (DefaultTableModel) table.getModel(); model = (DefaultTableModel) ruleTable.getModel();
setruleconfig.edit((Vector) model.getDataVector().get(select),select,pane.getTitleAt(pane.getSelectedIndex())); setConfig.edit((Vector) model.getDataVector().get(select), select, pane.getTitleAt(pane.getSelectedIndex()));
} }
} }
} }
private void RuleRemoveMouseClicked(MouseEvent e,JTabbedPane pane){ private void ruleRemoveMouseClicked(MouseEvent e, JTabbedPane pane){
if (table.getSelectedRowCount()>=1){ if (ruleTable.getSelectedRowCount() >= 1){
int isOk = JOptionPane.showConfirmDialog(null,"Are your sure?","RuleSetting - Delete Rule",JOptionPane.OK_OPTION); int isOk = JOptionPane.showConfirmDialog(null, "Are your sure?", "RuleSetting - Delete Rule", JOptionPane.OK_OPTION);
if (isOk==0){ if (isOk == 0){
int select = table.convertRowIndexToModel(table.getSelectedRow()); int select = ruleTable.convertRowIndexToModel(ruleTable.getSelectedRow());
model.removeRow(select); model.removeRow(select);
model = (DefaultTableModel) table.getModel(); model = (DefaultTableModel) ruleTable.getModel();
setruleconfig.remove(select,pane.getTitleAt(pane.getSelectedIndex())); setConfig.remove(select, pane.getTitleAt(pane.getSelectedIndex()));
} }
} }
} }
private void RuleTableChange(TableModelEvent e,JTabbedPane pane) { private void ruleTableChange(TableModelEvent e, JTabbedPane pane) {
if (e.getColumn()==0&&table.getSelectedRow()!=-1&&!isEdit){ if (e.getColumn() == 0 && ruleTable.getSelectedRow() != -1 && !isEdit){
model = (DefaultTableModel) table.getModel(); model = (DefaultTableModel) ruleTable.getModel();
int select = table.convertRowIndexToModel(table.getSelectedRow()); int select = ruleTable.convertRowIndexToModel(ruleTable.getSelectedRow());
setruleconfig.edit((Vector) model.getDataVector().get(select),select,pane.getTitleAt(pane.getSelectedIndex())); setConfig.edit((Vector) model.getDataVector().get(select), select, pane.getTitleAt(pane.getSelectedIndex()));
} }
} }
private void initComponents(Object[][] data,JTabbedPane pane) { private void initComponents(Object[][] data, JTabbedPane pane) {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
RuleAdd = new JButton(); addButton = new JButton();
RuleEdit = new JButton(); editButton = new JButton();
scrollPane = new JScrollPane(); scrollPane = new JScrollPane();
table = new JTable(); ruleTable = new JTable();
Remove = new JButton(); removeButton = new JButton();
//======== this ======== //======== this ========
setLayout(new GridBagLayout()); setLayout(new GridBagLayout());
@@ -96,89 +97,96 @@ public class RulePane extends JPanel {
((GridBagLayout)getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4}; ((GridBagLayout)getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4};
((GridBagLayout)getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 1.0, 1.0E-4}; ((GridBagLayout)getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 1.0, 1.0E-4};
//---- RuleAdd ---- //---- addButton ----
RuleAdd.setText("Add"); addButton.setText("Add");
RuleAdd.addMouseListener(new MouseAdapter() {
addButton.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
isEdit = true; isEdit = true;
RuleAddMouseClicked(e,pane); ruleAddMouseClicked(e, pane);
model = (DefaultTableModel) table.getModel(); model = (DefaultTableModel) ruleTable.getModel();
isEdit = false; isEdit = false;
} }
}); });
add(RuleAdd, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
add(addButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(15, 5, 3, 2), 0, 0)); new Insets(15, 5, 3, 2), 0, 0));
//---- RuleEdit ---- //---- editButton ----
RuleEdit.setText("Edit"); editButton.setText("Edit");
RuleEdit.addMouseListener(new MouseAdapter() { editButton.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
isEdit = true; isEdit = true;
RuleEditMouseClicked(e,pane); ruleEditMouseClicked(e, pane);
model = (DefaultTableModel) table.getModel(); model = (DefaultTableModel) ruleTable.getModel();
isEdit = false; isEdit = false;
} }
}); });
add(RuleEdit, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
add(editButton, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 5, 3, 2), 0, 0)); new Insets(0, 5, 3, 2), 0, 0));
//======== scrollPane ======== //======== scrollPane ========
{ {
//---- table ---- //---- table ----
table.setShowVerticalLines(false); ruleTable.setShowVerticalLines(false);
table.setVerifyInputWhenFocusTarget(false); ruleTable.setVerifyInputWhenFocusTarget(false);
table.setUpdateSelectionOnSort(false); ruleTable.setUpdateSelectionOnSort(false);
table.setShowHorizontalLines(false); ruleTable.setShowHorizontalLines(false);
table.setModel(new DefaultTableModel()); ruleTable.setModel(new DefaultTableModel());
table.setSurrendersFocusOnKeystroke(true); ruleTable.setSurrendersFocusOnKeystroke(true);
scrollPane.setViewportView(table); scrollPane.setViewportView(ruleTable);
} }
add(scrollPane, new GridBagConstraints(1, 0, 1, 4, 0.0, 0.0, add(scrollPane, new GridBagConstraints(1, 0, 1, 4, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(15, 5, 5, 5), 0, 0)); new Insets(15, 5, 5, 5), 0, 0));
//---- Remove ---- //---- removeButton ----
Remove.setText("Remove"); removeButton.setText("Remove");
Remove.addMouseListener(new MouseAdapter() {
removeButton.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
isEdit = true; isEdit = true;
RuleRemoveMouseClicked(e,pane); ruleRemoveMouseClicked(e, pane);
model = (DefaultTableModel) table.getModel(); model = (DefaultTableModel) ruleTable.getModel();
isEdit = false; isEdit = false;
} }
}); });
add(Remove, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
add(removeButton, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 5, 3, 2), 0, 0)); new Insets(0, 5, 3, 2), 0, 0));
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
table.setModel(model); ruleTable.setModel(model);
model.setDataVector(data,title); model.setDataVector(data, title);
model.addTableModelListener(new TableModelListener() { model.addTableModelListener(new TableModelListener() {
@Override @Override
public void tableChanged(TableModelEvent e) { public void tableChanged(TableModelEvent e) {
RuleTableChange(e,pane); ruleTableChange(e, pane);
} }
}); });
table.setRowSorter(new TableRowSorter(model));
ruleTable.setRowSorter(new TableRowSorter(model));
} }
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
public JButton RuleAdd; public JButton addButton;
public JButton RuleEdit; public JButton editButton;
public JScrollPane scrollPane; public JScrollPane scrollPane;
public JTable table; public JTable ruleTable;
public JButton Remove; public JButton removeButton;
// JFormDesigner - End of variables declaration //GEN-END:variables // JFormDesigner - End of variables declaration //GEN-END:variables
private final String[] title = new String[]{"Loaded", "Name", "Regex", "Color", "Scope", "Engine"}; private final String[] title = new String[]{"Loaded", "Name", "Regex", "Color", "Scope", "Engine"};
private DefaultTableModel model = new DefaultTableModel() { private DefaultTableModel model = new DefaultTableModel() {
@Override @Override
public Class<?> getColumnClass ( int column){ public Class<?> getColumnClass (int column){
if (column == 0) { if (column == 0) {
return Boolean.class; return Boolean.class;
}else{ }else{
@@ -187,12 +195,8 @@ public class RulePane extends JPanel {
} }
@Override @Override
public boolean isCellEditable(int row,int column){ public boolean isCellEditable(int row, int column){
if (column ==0){ return column == 0;
return true;
}else {
return false;
}
} }
}; };
} }

View File

@@ -4,7 +4,7 @@ import javax.swing.*;
import java.awt.*; import java.awt.*;
import burp.Config; import burp.Config;
/* /**
* @author LinChen * @author LinChen
*/ */
@@ -14,67 +14,56 @@ public class RuleSetting extends JPanel {
} }
public void initComponents() { public void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents engineLabel = new JLabel();
label5 = new JLabel(); scopeLabel = new JLabel();
label4 = new JLabel(); regexTextField = new JTextField();
Regex = new JTextField(); regexLabel = new JLabel();
label3 = new JLabel(); nameLabel = new JLabel();
label2 = new JLabel();
Name = new JTextField(); Name = new JTextField();
ScopeSelect = new JComboBox<>(); scopeComboBox = new JComboBox<>();
EngineSelect = new JComboBox<>(); engineComboBox = new JComboBox<>();
label6 = new JLabel(); colorLabel = new JLabel();
ColorSelect = new JComboBox<>(); colorComboBox = new JComboBox<>();
//======== this ========
setLayout(null); setLayout(null);
//---- label5 ---- engineLabel.setText("Engine:");
label5.setText("Engine:"); add(engineLabel);
add(label5); engineLabel.setBounds(new Rectangle(new Point(10, 175), engineLabel.getPreferredSize()));
label5.setBounds(new Rectangle(new Point(10, 175), label5.getPreferredSize()));
//---- label4 ---- scopeLabel.setText("Scope:");
label4.setText("Scope:"); add(scopeLabel);
add(label4); scopeLabel.setBounds(new Rectangle(new Point(10, 135), scopeLabel.getPreferredSize()));
label4.setBounds(new Rectangle(new Point(10, 135), label4.getPreferredSize())); add(regexTextField);
add(Regex); regexTextField.setBounds(70, 50, 265, 30);
Regex.setBounds(70, 50, 265, 30);
//---- label3 ---- regexLabel.setText("Regex:");
label3.setText("Regex:"); add(regexLabel);
add(label3); regexLabel.setBounds(new Rectangle(new Point(10, 55), regexLabel.getPreferredSize()));
label3.setBounds(new Rectangle(new Point(10, 55), label3.getPreferredSize()));
//---- label2 ---- nameLabel.setText("Name:");
label2.setText("Name:"); add(nameLabel);
add(label2); nameLabel.setBounds(new Rectangle(new Point(10, 15), nameLabel.getPreferredSize()));
label2.setBounds(new Rectangle(new Point(10, 15), label2.getPreferredSize()));
add(Name); add(Name);
Name.setBounds(70, 10, 265, 30); Name.setBounds(70, 10, 265, 30);
//---- ScopeSelect ---- scopeComboBox.setModel(new DefaultComboBoxModel<>(Config.scopeArray));
ScopeSelect.setModel(new DefaultComboBoxModel<>(Config.scopeArray)); add(scopeComboBox);
add(ScopeSelect); scopeComboBox.setBounds(70, 130, 265, scopeComboBox.getPreferredSize().height);
ScopeSelect.setBounds(70, 130, 265, ScopeSelect.getPreferredSize().height);
//---- EngineSelect ---- engineComboBox.setModel(new DefaultComboBoxModel<>(Config.engineArray));
EngineSelect.setModel(new DefaultComboBoxModel<>(Config.engineArray)); add(engineComboBox);
add(EngineSelect); engineComboBox.setBounds(70, 170, 265, engineComboBox.getPreferredSize().height);
EngineSelect.setBounds(70, 170, 265, EngineSelect.getPreferredSize().height);
//---- label7 ---- colorLabel.setText("Color:");
label6.setText("Color:"); add(colorLabel);
add(label6); colorLabel.setBounds(new Rectangle(new Point(10, 95), colorLabel.getPreferredSize()));
label6.setBounds(new Rectangle(new Point(10, 95), label6.getPreferredSize()));
//---- ColorSelect ---- colorComboBox.setModel(new DefaultComboBoxModel<>(Config.colorArray));
ColorSelect.setModel(new DefaultComboBoxModel<>(Config.colorArray)); add(colorComboBox);
add(ColorSelect); colorComboBox.setBounds(70, 90, 265, colorComboBox.getPreferredSize().height);
ColorSelect.setBounds(70, 90, 265, ColorSelect.getPreferredSize().height);
{ {
// compute preferred size
Dimension preferredSize = new Dimension(); Dimension preferredSize = new Dimension();
for(int i = 0; i < getComponentCount(); i++) { for(int i = 0; i < getComponentCount(); i++) {
Rectangle bounds = getComponent(i).getBounds(); Rectangle bounds = getComponent(i).getBounds();
@@ -87,19 +76,16 @@ public class RuleSetting extends JPanel {
setMinimumSize(preferredSize); setMinimumSize(preferredSize);
setPreferredSize(preferredSize); setPreferredSize(preferredSize);
} }
// JFormDesigner - End of component initialization //GEN-END:initComponents
} }
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private JLabel engineLabel;
private JLabel label5; private JLabel scopeLabel;
private JLabel label4; public JTextField regexTextField;
public JTextField Regex; private JLabel regexLabel;
private JLabel label3; private JLabel nameLabel;
private JLabel label2;
public JTextField Name; public JTextField Name;
public JComboBox<String> ScopeSelect; public JComboBox<String> scopeComboBox;
public JComboBox<String> EngineSelect; public JComboBox<String> engineComboBox;
private JLabel label6; private JLabel colorLabel;
public JComboBox<String> ColorSelect; public JComboBox<String> colorComboBox;
// JFormDesigner - End of variables declaration //GEN-END:variables
} }

View File

@@ -3,7 +3,7 @@ package burp.yaml.template;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/* /**
* @author LinChen * @author LinChen
*/ */

View File

@@ -4,7 +4,7 @@ import burp.yaml.template.Rule;
import java.util.List; import java.util.List;
/* /**
* @author LinChen * @author LinChen
*/ */