Version: 2.3 Update
This commit is contained in:
@@ -32,7 +32,7 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
||||
this.callbacks = callbacks;
|
||||
BurpExtender.helpers = callbacks.getHelpers();
|
||||
|
||||
String version = "2.2.3";
|
||||
String version = "2.3";
|
||||
callbacks.setExtensionName(String.format("HaE (%s) - Highlighter and Extractor", version));
|
||||
// 定义输出
|
||||
stdout = new PrintWriter(callbacks.getStdout(), true);
|
||||
@@ -189,6 +189,7 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
||||
Object[][] data = new Object[extractData.length][1];
|
||||
for (int x = 0; x < extractData.length; x++) {
|
||||
data[x][0] = extractData[x];
|
||||
stdout.println(extractData[x]);
|
||||
}
|
||||
int indexOfTab = this.jTabbedPane.indexOfTab(i);
|
||||
JScrollPane jScrollPane = new JScrollPane(new JTable(data, new Object[] {"Information"}));
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
import burp.Config;
|
||||
import burp.yaml.LoadConfig;
|
||||
import dk.brics.automaton.Automaton;
|
||||
import dk.brics.automaton.AutomatonMatcher;
|
||||
import dk.brics.automaton.RegExp;
|
||||
@@ -33,6 +32,7 @@ public class ExtractContent {
|
||||
String color = objects[3].toString();
|
||||
String scope = objects[4].toString();
|
||||
String engine = objects[5].toString();
|
||||
boolean sensitive = (Boolean) objects[6];
|
||||
// 判断规则是否开启与作用域
|
||||
if (loaded && (scope.contains(scopeString) || "any".equals(scope))) {
|
||||
switch (scope) {
|
||||
@@ -54,7 +54,13 @@ public class ExtractContent {
|
||||
}
|
||||
|
||||
if ("nfa".equals(engine)) {
|
||||
Pattern pattern = new Pattern(regex);
|
||||
Pattern pattern;
|
||||
// 判断规则是否大小写敏感
|
||||
if (sensitive) {
|
||||
pattern = new Pattern(regex);
|
||||
} else {
|
||||
pattern = new Pattern(regex, Pattern.IGNORE_CASE);
|
||||
}
|
||||
Matcher matcher = pattern.matcher(matchContent);
|
||||
while (matcher.find()) {
|
||||
// 添加匹配数据至list
|
||||
|
||||
@@ -284,7 +284,7 @@ class TabTitleEditListener extends MouseAdapter implements ChangeListener, Docum
|
||||
}
|
||||
|
||||
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", false}};
|
||||
insertTab(ruleEditTabbedPane, setConfig.newRules(),data);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package burp.ui;
|
||||
|
||||
import burp.yaml.SetConfig;
|
||||
|
||||
import java.awt.event.ComponentListener;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.event.TableModelListener;
|
||||
@@ -24,38 +25,46 @@ public class RulePane extends JPanel {
|
||||
private Boolean isEdit = false;
|
||||
|
||||
private void ruleAddMouseClicked(MouseEvent e, JTabbedPane pane) {
|
||||
RuleSetting add = new RuleSetting();
|
||||
int isOk = JOptionPane.showConfirmDialog(null, add, "RuleSetting - Add Rule", JOptionPane.OK_OPTION);
|
||||
if(isOk == 0){
|
||||
Vector data = new Vector();
|
||||
data.add(false);
|
||||
data.add(add.Name.getText());
|
||||
data.add(add.regexTextField.getText());
|
||||
data.add(add.colorComboBox.getSelectedItem().toString());
|
||||
data.add(add.scopeComboBox.getSelectedItem().toString());
|
||||
data.add(add.engineComboBox.getSelectedItem().toString());
|
||||
model.insertRow(model.getRowCount(), data);
|
||||
RuleSetting ruleSettingPanel = new RuleSetting();
|
||||
int showState = JOptionPane.showConfirmDialog(null, ruleSettingPanel, "RuleSetting - Add Rule", JOptionPane.OK_OPTION);
|
||||
if(showState == 0){
|
||||
Vector ruleData = new Vector();
|
||||
ruleData.add(false);
|
||||
ruleData.add(ruleSettingPanel.ruleNameTextField.getText());
|
||||
ruleData.add(ruleSettingPanel.regexTextField.getText());
|
||||
ruleData.add(ruleSettingPanel.colorComboBox.getSelectedItem().toString());
|
||||
ruleData.add(ruleSettingPanel.scopeComboBox.getSelectedItem().toString());
|
||||
ruleData.add(ruleSettingPanel.engineComboBox.getSelectedItem().toString());
|
||||
ruleData.add(ruleSettingPanel.sensitiveComboBox.getSelectedItem());
|
||||
model.insertRow(model.getRowCount(), ruleData);
|
||||
model = (DefaultTableModel) ruleTable.getModel();
|
||||
setConfig.add(data, pane.getTitleAt(pane.getSelectedIndex()));
|
||||
setConfig.add(ruleData, pane.getTitleAt(pane.getSelectedIndex()));
|
||||
}
|
||||
}
|
||||
|
||||
private void ruleEditMouseClicked(MouseEvent e, JTabbedPane pane){
|
||||
if (ruleTable.getSelectedRowCount() >= 1){
|
||||
RuleSetting edit = new RuleSetting();
|
||||
edit.Name.setText(ruleTable.getValueAt(ruleTable.getSelectedRow(), 1).toString());
|
||||
edit.regexTextField.setText(ruleTable.getValueAt(ruleTable.getSelectedRow(), 2).toString());
|
||||
edit.colorComboBox.setSelectedItem(ruleTable.getValueAt(ruleTable.getSelectedRow(), 3).toString());
|
||||
edit.scopeComboBox.setSelectedItem(ruleTable.getValueAt(ruleTable.getSelectedRow(), 4).toString());
|
||||
edit.engineComboBox.setSelectedItem(ruleTable.getValueAt(ruleTable.getSelectedRow(), 5).toString());
|
||||
int isOk = JOptionPane.showConfirmDialog(null, edit, "RuleSetting - Edit Rule", JOptionPane.OK_OPTION);
|
||||
if (isOk == 0){
|
||||
RuleSetting ruleSettingPanel = new RuleSetting();
|
||||
ruleSettingPanel.ruleNameTextField.setText(ruleTable.getValueAt(ruleTable.getSelectedRow(), 1).toString());
|
||||
ruleSettingPanel.regexTextField.setText(ruleTable.getValueAt(ruleTable.getSelectedRow(), 2).toString());
|
||||
ruleSettingPanel.colorComboBox.setSelectedItem(ruleTable.getValueAt(ruleTable.getSelectedRow(), 3).toString());
|
||||
ruleSettingPanel.scopeComboBox.setSelectedItem(ruleTable.getValueAt(ruleTable.getSelectedRow(), 4).toString());
|
||||
ruleSettingPanel.engineComboBox.setSelectedItem(ruleTable.getValueAt(ruleTable.getSelectedRow(), 5).toString());
|
||||
ruleSettingPanel.sensitiveComboBox.setSelectedItem(ruleTable.getValueAt(ruleTable.getSelectedRow(),6).toString());
|
||||
|
||||
ruleSettingPanel.sensitiveComboBox.setEnabled(
|
||||
ruleSettingPanel.engineComboBox.getSelectedItem().toString().equals("nfa")
|
||||
);
|
||||
|
||||
int showState = JOptionPane.showConfirmDialog(null, ruleSettingPanel, "RuleSetting - Edit Rule", JOptionPane.OK_OPTION);
|
||||
if (showState == 0){
|
||||
int select = ruleTable.convertRowIndexToModel(ruleTable.getSelectedRow());
|
||||
model.setValueAt(edit.Name.getText(), select, 1);
|
||||
model.setValueAt(edit.regexTextField.getText(), select, 2);
|
||||
model.setValueAt(edit.colorComboBox.getSelectedItem().toString(), select, 3);
|
||||
model.setValueAt(edit.scopeComboBox.getSelectedItem().toString(), select, 4);
|
||||
model.setValueAt(edit.engineComboBox.getSelectedItem().toString(), select, 5);
|
||||
model.setValueAt(ruleSettingPanel.ruleNameTextField.getText(), select, 1);
|
||||
model.setValueAt(ruleSettingPanel.regexTextField.getText(), select, 2);
|
||||
model.setValueAt(ruleSettingPanel.colorComboBox.getSelectedItem().toString(), select, 3);
|
||||
model.setValueAt(ruleSettingPanel.scopeComboBox.getSelectedItem().toString(), select, 4);
|
||||
model.setValueAt(ruleSettingPanel.engineComboBox.getSelectedItem().toString(), select, 5);
|
||||
model.setValueAt(ruleSettingPanel.sensitiveComboBox.getSelectedItem(), select, 6);
|
||||
model = (DefaultTableModel) ruleTable.getModel();
|
||||
setConfig.edit((Vector) model.getDataVector().get(select), select, pane.getTitleAt(pane.getSelectedIndex()));
|
||||
}
|
||||
@@ -110,9 +119,9 @@ public class RulePane extends JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
add(addButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
||||
new Insets(15, 5, 3, 2), 0, 0));
|
||||
add(addButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
||||
new Insets(15, 5, 3, 2), 0, 0));
|
||||
|
||||
//---- editButton ----
|
||||
editButton.setText("Edit");
|
||||
@@ -126,9 +135,9 @@ public class RulePane extends JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
add(editButton, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
||||
new Insets(0, 5, 3, 2), 0, 0));
|
||||
add(editButton, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
||||
new Insets(0, 5, 3, 2), 0, 0));
|
||||
|
||||
//======== scrollPane ========
|
||||
{
|
||||
@@ -142,9 +151,9 @@ public class RulePane extends JPanel {
|
||||
scrollPane.setViewportView(ruleTable);
|
||||
}
|
||||
|
||||
add(scrollPane, new GridBagConstraints(1, 0, 1, 4, 0.0, 0.0,
|
||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
||||
new Insets(15, 5, 5, 5), 0, 0));
|
||||
add(scrollPane, new GridBagConstraints(1, 0, 1, 4, 0.0, 0.0,
|
||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
||||
new Insets(15, 5, 5, 5), 0, 0));
|
||||
|
||||
//---- removeButton ----
|
||||
removeButton.setText("Remove");
|
||||
@@ -159,9 +168,9 @@ public class RulePane extends JPanel {
|
||||
}
|
||||
});
|
||||
|
||||
add(removeButton, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
||||
new Insets(0, 5, 3, 2), 0, 0));
|
||||
add(removeButton, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
||||
new Insets(0, 5, 3, 2), 0, 0));
|
||||
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
ruleTable.setModel(model);
|
||||
@@ -183,7 +192,7 @@ public class RulePane extends JPanel {
|
||||
public JTable ruleTable;
|
||||
public JButton removeButton;
|
||||
// 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", "Sensitive"};
|
||||
private DefaultTableModel model = new DefaultTableModel() {
|
||||
@Override
|
||||
public Class<?> getColumnClass (int column){
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package burp.ui;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import burp.Config;
|
||||
@@ -14,16 +18,18 @@ public class RuleSetting extends JPanel {
|
||||
}
|
||||
|
||||
public void initComponents() {
|
||||
sensitiveLabel = new JLabel();
|
||||
engineLabel = new JLabel();
|
||||
scopeLabel = new JLabel();
|
||||
regexTextField = new JTextField();
|
||||
regexLabel = new JLabel();
|
||||
nameLabel = new JLabel();
|
||||
Name = new JTextField();
|
||||
ruleNameTextField = new JTextField();
|
||||
scopeComboBox = new JComboBox<>();
|
||||
engineComboBox = new JComboBox<>();
|
||||
colorLabel = new JLabel();
|
||||
colorComboBox = new JComboBox<>();
|
||||
sensitiveComboBox = new JComboBox<>();
|
||||
|
||||
setLayout(null);
|
||||
|
||||
@@ -31,6 +37,10 @@ public class RuleSetting extends JPanel {
|
||||
add(engineLabel);
|
||||
engineLabel.setBounds(new Rectangle(new Point(10, 175), engineLabel.getPreferredSize()));
|
||||
|
||||
sensitiveLabel.setText("Sensitive:");
|
||||
add(sensitiveLabel);
|
||||
sensitiveLabel.setBounds(new Rectangle(new Point(10,215), sensitiveLabel.getPreferredSize()));
|
||||
|
||||
scopeLabel.setText("Scope:");
|
||||
add(scopeLabel);
|
||||
scopeLabel.setBounds(new Rectangle(new Point(10, 135), scopeLabel.getPreferredSize()));
|
||||
@@ -44,14 +54,25 @@ public class RuleSetting extends JPanel {
|
||||
nameLabel.setText("Name:");
|
||||
add(nameLabel);
|
||||
nameLabel.setBounds(new Rectangle(new Point(10, 15), nameLabel.getPreferredSize()));
|
||||
add(Name);
|
||||
Name.setBounds(70, 10, 265, 30);
|
||||
add(ruleNameTextField);
|
||||
ruleNameTextField.setBounds(70, 10, 265, 30);
|
||||
|
||||
scopeComboBox.setModel(new DefaultComboBoxModel<>(Config.scopeArray));
|
||||
add(scopeComboBox);
|
||||
scopeComboBox.setBounds(70, 130, 265, scopeComboBox.getPreferredSize().height);
|
||||
|
||||
engineComboBox.setModel(new DefaultComboBoxModel<>(Config.engineArray));
|
||||
engineComboBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String engineValue = engineComboBox.getSelectedItem().toString();
|
||||
if (engineValue.equals("nfa")) {
|
||||
sensitiveComboBox.setEnabled(true);
|
||||
} else {
|
||||
sensitiveComboBox.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
add(engineComboBox);
|
||||
engineComboBox.setBounds(70, 170, 265, engineComboBox.getPreferredSize().height);
|
||||
|
||||
@@ -63,6 +84,10 @@ public class RuleSetting extends JPanel {
|
||||
add(colorComboBox);
|
||||
colorComboBox.setBounds(70, 90, 265, colorComboBox.getPreferredSize().height);
|
||||
|
||||
sensitiveComboBox.setModel(new DefaultComboBoxModel<>(new Boolean[]{true, false}));
|
||||
add(sensitiveComboBox);
|
||||
sensitiveComboBox.setBounds(70,210,265,sensitiveComboBox.getPreferredSize().height);
|
||||
|
||||
{
|
||||
Dimension preferredSize = new Dimension();
|
||||
for(int i = 0; i < getComponentCount(); i++) {
|
||||
@@ -79,13 +104,15 @@ public class RuleSetting extends JPanel {
|
||||
}
|
||||
|
||||
private JLabel engineLabel;
|
||||
private JLabel sensitiveLabel;
|
||||
private JLabel scopeLabel;
|
||||
public JTextField regexTextField;
|
||||
private JLabel regexLabel;
|
||||
private JLabel nameLabel;
|
||||
public JTextField Name;
|
||||
public JTextField ruleNameTextField;
|
||||
public JComboBox<String> scopeComboBox;
|
||||
public JComboBox<String> engineComboBox;
|
||||
private JLabel colorLabel;
|
||||
public JComboBox<String> colorComboBox;
|
||||
public JComboBox<Boolean> sensitiveComboBox;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ public class LoadConfig {
|
||||
rule.setEngine("nfa");
|
||||
rule.setScope("response");
|
||||
rule.setRegex("(([a-zA-Z0-9][_|\\.])*[a-zA-Z0-9]+@([a-zA-Z0-9][-|_|\\.])*[a-zA-Z0-9]+\\.((?!js|css|jpg|jpeg|png|ico)[a-zA-Z]{2,}))");
|
||||
rule.setSensitive(false);
|
||||
|
||||
Rules rules = new Rules();
|
||||
rules.setType("Basic Information");
|
||||
ArrayList<Rule> rl = new ArrayList<>();
|
||||
|
||||
@@ -40,6 +40,7 @@ public class SetConfig {
|
||||
rlTmp.setColor((String) objects[3]);
|
||||
rlTmp.setScope((String) objects[4]);
|
||||
rlTmp.setEngine((String) objects[5]);
|
||||
rlTmp.setSensitive((Boolean) objects[6]);
|
||||
rl.add(rlTmp);
|
||||
}
|
||||
rlsTmp.setRule(rl);
|
||||
@@ -87,7 +88,7 @@ public class SetConfig {
|
||||
String name = "New ";
|
||||
Object[][] data = new Object[][]{
|
||||
{
|
||||
false, "New Name", "(New Regex)", "gray", "any", "nfa"
|
||||
false, "New Name", "(New Regex)", "gray", "any", "nfa", false
|
||||
}
|
||||
};
|
||||
while (Config.ruleConfig.containsKey(name + i)) {
|
||||
|
||||
@@ -14,6 +14,7 @@ public class Rule {
|
||||
private String Color;
|
||||
private String Engine;
|
||||
private String Scope;
|
||||
private Boolean Sensitive;
|
||||
|
||||
public Boolean getLoaded() {
|
||||
return Loaded;
|
||||
@@ -38,6 +39,9 @@ public class Rule {
|
||||
return Scope;
|
||||
}
|
||||
|
||||
public Boolean getSensitive(){
|
||||
return Sensitive = Sensitive;
|
||||
}
|
||||
public void setLoaded(Boolean loaded) {
|
||||
this.Loaded = loaded;
|
||||
}
|
||||
@@ -62,9 +66,12 @@ public class Rule {
|
||||
public void setScope(String scope) {
|
||||
this.Scope = scope;
|
||||
}
|
||||
public void setSensitive(Boolean sensitive){
|
||||
this.Sensitive = sensitive;
|
||||
}
|
||||
|
||||
public Object[] getRuleObject() {
|
||||
return new Object[] { Loaded, Name, Regex, Color, Scope, Engine };
|
||||
return new Object[] { Loaded, Name, Regex, Color, Scope, Engine,Sensitive };
|
||||
}
|
||||
|
||||
public Map<String, Object> getRuleObjMap(){
|
||||
@@ -75,10 +82,12 @@ public class Rule {
|
||||
r.put("Color", Color);
|
||||
r.put("Scope", Scope);
|
||||
r.put("Engine", Engine);
|
||||
r.put("Sensitive", Sensitive);
|
||||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{ \nLoaded: " + Loaded + "\nName: " + Name + "\nRegex: " + Regex + "\nColor: " + Color + "\nScope: " + Scope + "\nEngine: " + Engine + "\n}";
|
||||
return "{ \nLoaded: " + Loaded + "\nName: " + Name + "\nRegex: " + Regex + "\nColor: " + Color + "\nScope: " + Scope + "\nEngine: " + Engine + "\nSensitive: " + Sensitive + "\n }";
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,9 @@ public class Rules {
|
||||
this.rule = rule;
|
||||
}
|
||||
|
||||
public void setRuleObj(){
|
||||
public void setRuleObj(){}
|
||||
|
||||
}
|
||||
@Override
|
||||
public String toString(){
|
||||
return "{ type: "+type+"\n config: "+ rule +"}\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user