Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b79c71df9 | ||
|
|
9ea0e4be9c | ||
|
|
41f197bcb2 | ||
|
|
31e419aed2 | ||
|
|
cf90a9366a | ||
|
|
6546446e4f | ||
|
|
6c4073c8ee | ||
|
|
1e1d51921d | ||
|
|
9135b8cbd2 | ||
|
|
cc7956d8dc | ||
|
|
405efdd5da | ||
|
|
0bb425f00b | ||
|
|
0bdff6fe28 | ||
|
|
6bd153d16a | ||
|
|
b12f9355fa | ||
|
|
fa9dcfc3d2 | ||
|
|
2e23388925 | ||
|
|
06fd54c9ce | ||
|
|
0707a773c8 | ||
|
|
d0f49f8e6c | ||
|
|
5404c90c00 |
Binary file not shown.
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 334 KiB |
@@ -5,13 +5,10 @@ import burp.core.processor.MessageProcessor;
|
|||||||
import burp.ui.MainUI;
|
import burp.ui.MainUI;
|
||||||
import burp.ui.board.MessagePanel;
|
import burp.ui.board.MessagePanel;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Map;
|
import java.util.*;
|
||||||
import java.util.Objects;
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
@@ -36,7 +33,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.5";
|
String version = "2.5.1";
|
||||||
callbacks.setExtensionName(String.format("HaE (%s) - Highlighter and Extractor", version));
|
callbacks.setExtensionName(String.format("HaE (%s) - Highlighter and Extractor", version));
|
||||||
|
|
||||||
// 定义输出
|
// 定义输出
|
||||||
@@ -92,16 +89,18 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
|
|
||||||
IHttpService iHttpService = null;
|
IHttpService iHttpService = null;
|
||||||
|
|
||||||
|
String host = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
iHttpService = messageInfo.getHttpService();
|
iHttpService = messageInfo.getHttpService();
|
||||||
|
host = iHttpService.getHost();
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取请求主机信息
|
if (Objects.equals(host, "")) {
|
||||||
assert iHttpService != null;
|
List<String> requestTmpHeaders = helpers.analyzeRequest(content).getHeaders();
|
||||||
String host = iHttpService.getHost();
|
host = requestTmpHeaders.get(1).split(":")[1].trim();
|
||||||
|
}
|
||||||
String c = new String(content, StandardCharsets.UTF_8).intern();
|
|
||||||
|
|
||||||
List<Map<String, String>> result = null;
|
List<Map<String, String>> result = null;
|
||||||
try {
|
try {
|
||||||
@@ -125,19 +124,54 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
messageInfo.setHighlight(resColor);
|
messageInfo.setHighlight(resColor);
|
||||||
|
|
||||||
String addComment = String.join(", ", result.get(1).get("comment"));
|
String addComment = String.join(", ", result.get(1).get("comment"));
|
||||||
resComment = !Objects.equals(originalComment, "") ? String.format("%s, %s", originalComment, addComment) : addComment;
|
String allComment = !Objects.equals(originalComment, "") ? String.format("%s, %s", originalComment, addComment) : addComment;
|
||||||
|
resComment = mergeComment(allComment);
|
||||||
messageInfo.setComment(resComment);
|
messageInfo.setComment(resComment);
|
||||||
}
|
}
|
||||||
|
|
||||||
String endComment = resComment.isEmpty() ? originalComment : resComment;
|
String endComment = resComment.isEmpty() ? originalComment : resComment;
|
||||||
String endColor = resColor.isEmpty() ? originalColor : resColor;
|
String endColor = resColor.isEmpty() ? originalColor : resColor;
|
||||||
|
|
||||||
if (!messageIsRequest && !endComment.isEmpty() && !endColor.isEmpty()) {
|
if (!messageIsRequest && !Objects.equals(endComment, "") && !Objects.equals(endColor, "")) {
|
||||||
messagePanel.add(messageInfo, endComment, String.valueOf(content.length), endColor);
|
messagePanel.add(messageInfo, endComment, String.valueOf(content.length), endColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String mergeComment(String comment) {
|
||||||
|
if (!comment.contains(",")) {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Integer> itemCounts = new HashMap<>();
|
||||||
|
String[] items = comment.split(", ");
|
||||||
|
|
||||||
|
for (String item : items) {
|
||||||
|
if (item.contains("(") && item.contains(")")) {
|
||||||
|
int openParenIndex = item.lastIndexOf("(");
|
||||||
|
int closeParenIndex = item.lastIndexOf(")");
|
||||||
|
String itemName = item.substring(0, openParenIndex).trim();
|
||||||
|
int count = Integer.parseInt(item.substring(openParenIndex + 1, closeParenIndex).trim());
|
||||||
|
itemCounts.put(itemName, itemCounts.getOrDefault(itemName, 0) + count);
|
||||||
|
} else {
|
||||||
|
itemCounts.put(item, 0);
|
||||||
|
BurpExtender.stdout.println(String.format("%s: %s", "A", item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder mergedItems = new StringBuilder();
|
||||||
|
|
||||||
|
for (Map.Entry<String, Integer> entry : itemCounts.entrySet()) {
|
||||||
|
String itemName = entry.getKey();
|
||||||
|
int count = entry.getValue();
|
||||||
|
if (count != 0) {
|
||||||
|
mergedItems.append(itemName).append(" (").append(count).append("), ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mergedItems.substring(0, mergedItems.length() - 2);
|
||||||
|
}
|
||||||
|
|
||||||
class MarkInfoTab implements IMessageEditorTab {
|
class MarkInfoTab implements IMessageEditorTab {
|
||||||
private final JTabbedPane jTabbedPane = new JTabbedPane();
|
private final JTabbedPane jTabbedPane = new JTabbedPane();
|
||||||
private JTable jTable = new JTable();
|
private JTable jTable = new JTable();
|
||||||
@@ -168,8 +202,8 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled(byte[] content, boolean isRequest) {
|
public boolean isEnabled(byte[] content, boolean isRequest) {
|
||||||
String c = new String(content, StandardCharsets.UTF_8).intern();
|
|
||||||
List<Map<String, String>> result = null;
|
List<Map<String, String>> result = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = messageProcessor.processMessage(helpers, content, isRequest, false, "");
|
result = messageProcessor.processMessage(helpers, content, isRequest, false, "");
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
@@ -219,7 +253,6 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setMessage(byte[] content, boolean isRequest) {
|
public void setMessage(byte[] content, boolean isRequest) {
|
||||||
String c = new String(content, StandardCharsets.UTF_8).intern();
|
|
||||||
if (content.length > 0) {
|
if (content.length > 0) {
|
||||||
if (isRequest) {
|
if (isRequest) {
|
||||||
makeTable(extractRequestMap);
|
makeTable(extractRequestMap);
|
||||||
@@ -267,4 +300,4 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
public IMessageEditorTab createNewInstance(IMessageEditorController controller, boolean editable) {
|
public IMessageEditorTab createNewInstance(IMessageEditorController controller, boolean editable) {
|
||||||
return new MarkInfoTab(controller, editable);
|
return new MarkInfoTab(controller, editable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package burp.core.processor;
|
package burp.core.processor;
|
||||||
|
|
||||||
|
import burp.BurpExtender;
|
||||||
import burp.core.GlobalCachePool;
|
import burp.core.GlobalCachePool;
|
||||||
import burp.core.utils.HashCalculator;
|
import burp.core.utils.HashCalculator;
|
||||||
import burp.core.utils.MatchTool;
|
import burp.core.utils.MatchTool;
|
||||||
@@ -11,12 +12,8 @@ import dk.brics.automaton.RegExp;
|
|||||||
import dk.brics.automaton.RunAutomaton;
|
import dk.brics.automaton.RunAutomaton;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import jregex.Matcher;
|
import jregex.Matcher;
|
||||||
import jregex.Pattern;
|
import jregex.Pattern;
|
||||||
|
|
||||||
@@ -82,7 +79,7 @@ public class DataProcessingUnit {
|
|||||||
case "any":
|
case "any":
|
||||||
case "request":
|
case "request":
|
||||||
case "response":
|
case "response":
|
||||||
matchContent = new String(content, StandardCharsets.UTF_8).intern();
|
matchContent = new String(content, StandardCharsets.UTF_8);
|
||||||
break;
|
break;
|
||||||
case "any header":
|
case "any header":
|
||||||
case "request header":
|
case "request header":
|
||||||
@@ -92,7 +89,7 @@ public class DataProcessingUnit {
|
|||||||
case "any body":
|
case "any body":
|
||||||
case "request body":
|
case "request body":
|
||||||
case "response body":
|
case "response body":
|
||||||
matchContent = new String(body, StandardCharsets.UTF_8).intern();
|
matchContent = new String(body, StandardCharsets.UTF_8);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -136,9 +133,8 @@ public class DataProcessingUnit {
|
|||||||
String dataStr = String.join("\n", result);
|
String dataStr = String.join("\n", result);
|
||||||
tmpMap.put("data", dataStr);
|
tmpMap.put("data", dataStr);
|
||||||
finalMap.put(nameAndSize, tmpMap);
|
finalMap.put(nameAndSize, tmpMap);
|
||||||
|
|
||||||
// 添加到全局变量中,便于Databoard检索
|
// 添加到全局变量中,便于Databoard检索
|
||||||
if (!host.isEmpty()) {
|
if (!Objects.equals(host, "")) {
|
||||||
List<String> dataList = Arrays.asList(dataStr.split("\n"));
|
List<String> dataList = Arrays.asList(dataStr.split("\n"));
|
||||||
if (ConfigEntry.globalDataMap.containsKey(host)) {
|
if (ConfigEntry.globalDataMap.containsKey(host)) {
|
||||||
Map<String, List<String>> gRuleMap = new HashMap<>(ConfigEntry.globalDataMap.get(host));
|
Map<String, List<String>> gRuleMap = new HashMap<>(ConfigEntry.globalDataMap.get(host));
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package burp.core.utils;
|
package burp.core.utils;
|
||||||
|
|
||||||
|
import burp.BurpExtender;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class RuleTool {
|
|||||||
// 获取官方规则文件,在线更新写入
|
// 获取官方规则文件,在线更新写入
|
||||||
FileOutputStream fileOutputStream = new FileOutputStream(this.rulesFilePath);
|
FileOutputStream fileOutputStream = new FileOutputStream(this.rulesFilePath);
|
||||||
fileOutputStream.write(httpResponse.body().bytes());
|
fileOutputStream.write(httpResponse.body().bytes());
|
||||||
JOptionPane.showMessageDialog(null, "Config file updated successfully!", "Error",
|
JOptionPane.showMessageDialog(null, "Rules updated successfully!", "Info",
|
||||||
JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.INFORMATION_MESSAGE);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
JOptionPane.showMessageDialog(null, "Please check your network!", "Error",
|
JOptionPane.showMessageDialog(null, "Please check your network!", "Error",
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package burp.rule.utils;
|
package burp.rule.utils;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import burp.BurpExtender;
|
||||||
import org.yaml.snakeyaml.DumperOptions;
|
import org.yaml.snakeyaml.DumperOptions;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.yaml.snakeyaml.Yaml;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class MainUI extends JPanel {
|
|||||||
private void onlineUpdateActionPerformed(ActionEvent e) {
|
private void onlineUpdateActionPerformed(ActionEvent e) {
|
||||||
// 添加提示框防止用户误触导致配置更新
|
// 添加提示框防止用户误触导致配置更新
|
||||||
int retCode = JOptionPane.showConfirmDialog(null, "Do you want to update config?", "Info",
|
int retCode = JOptionPane.showConfirmDialog(null, "Do you want to update config?", "Info",
|
||||||
JOptionPane.YES_NO_CANCEL_OPTION);
|
JOptionPane.YES_NO_OPTION);
|
||||||
if (retCode == JOptionPane.YES_OPTION) {
|
if (retCode == JOptionPane.YES_OPTION) {
|
||||||
String rulesFilePath = rulesPathTextField.getText();
|
String rulesFilePath = rulesPathTextField.getText();
|
||||||
RuleTool rt = new RuleTool(rulesFilePath);
|
RuleTool rt = new RuleTool(rulesFilePath);
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ import java.util.Map;
|
|||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
|
||||||
public class CustomTableCellRenderer extends DefaultTableCellRenderer {
|
public class ColorRenderer extends DefaultTableCellRenderer {
|
||||||
|
|
||||||
private List<LogEntry> log;
|
private List<LogEntry> log;
|
||||||
private Map<String, Color> colorMap = new HashMap<>();
|
private Map<String, Color> colorMap = new HashMap<>();
|
||||||
private JTable table; // 保存对表格的引用
|
private JTable table; // 保存对表格的引用
|
||||||
|
|
||||||
public CustomTableCellRenderer(List<LogEntry> log, JTable table) {
|
public ColorRenderer(List<LogEntry> log, JTable table) {
|
||||||
this.log = log;
|
this.log = log;
|
||||||
this.colorMap.put("red", Color.RED);
|
this.colorMap.put("red", Color.RED);
|
||||||
this.colorMap.put("orange", Color.ORANGE);
|
this.colorMap.put("orange", Color.ORANGE);
|
||||||
@@ -3,9 +3,8 @@ package burp.ui.board;
|
|||||||
import burp.config.ConfigEntry;
|
import burp.config.ConfigEntry;
|
||||||
import burp.core.utils.StringHelper;
|
import burp.core.utils.StringHelper;
|
||||||
import burp.ui.board.MessagePanel.Table;
|
import burp.ui.board.MessagePanel.Table;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
import javax.swing.table.DefaultTableModel;
|
import javax.swing.table.DefaultTableModel;
|
||||||
@@ -15,8 +14,7 @@ import javax.swing.table.TableModel;
|
|||||||
import javax.swing.table.TableRowSorter;
|
import javax.swing.table.TableRowSorter;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.DocumentEvent;
|
||||||
import javax.swing.event.DocumentListener;
|
import javax.swing.event.DocumentListener;
|
||||||
@@ -48,21 +46,24 @@ public class Databoard extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void clearActionPerformed(ActionEvent e) {
|
private void clearActionPerformed(ActionEvent e) {
|
||||||
cleanUI();
|
int retCode = JOptionPane.showConfirmDialog(null, "Do you want to clear data?", "Info",
|
||||||
|
JOptionPane.YES_NO_OPTION);
|
||||||
|
if (retCode == JOptionPane.YES_OPTION) {
|
||||||
|
cleanUI();
|
||||||
|
|
||||||
String host = hostTextField.getText();
|
String host = hostTextField.getText();
|
||||||
String cleanedHost = StringHelper.replaceFirstOccurrence(host, "*.", "");
|
String cleanedHost = StringHelper.replaceFirstOccurrence(host, "*.", "");
|
||||||
|
|
||||||
if (host.contains("*")) {
|
if (host.contains("*")) {
|
||||||
ConfigEntry.globalDataMap.keySet().removeIf(i -> i.contains(cleanedHost) || cleanedHost.equals("**"));
|
ConfigEntry.globalDataMap.keySet().removeIf(i -> i.contains(cleanedHost) || cleanedHost.equals("**"));
|
||||||
} else {
|
} else {
|
||||||
ConfigEntry.globalDataMap.remove(host);
|
ConfigEntry.globalDataMap.remove(host);
|
||||||
|
}
|
||||||
|
|
||||||
|
messagePanel.deleteByHost(cleanedHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
messagePanel.deleteByHost(cleanedHost);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||||
hostLabel = new JLabel();
|
hostLabel = new JLabel();
|
||||||
@@ -115,6 +116,7 @@ public class Databoard extends JPanel {
|
|||||||
final JComboBox hostComboBox = new JComboBox(comboBoxModel) {
|
final JComboBox hostComboBox = new JComboBox(comboBoxModel) {
|
||||||
@Override
|
@Override
|
||||||
public Dimension getPreferredSize() {
|
public Dimension getPreferredSize() {
|
||||||
|
setMaximumRowCount(5);
|
||||||
return new Dimension(super.getPreferredSize().width, 0);
|
return new Dimension(super.getPreferredSize().width, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -130,8 +132,9 @@ public class Databoard extends JPanel {
|
|||||||
hostComboBox.addActionListener(e -> {
|
hostComboBox.addActionListener(e -> {
|
||||||
if (!isMatchHost) {
|
if (!isMatchHost) {
|
||||||
if (hostComboBox.getSelectedItem() != null) {
|
if (hostComboBox.getSelectedItem() != null) {
|
||||||
hostTextField.setText(hostComboBox.getSelectedItem().toString());
|
String selectedHost = hostComboBox.getSelectedItem().toString();
|
||||||
populateTabbedPaneByHost(hostComboBox);
|
hostTextField.setText(selectedHost);
|
||||||
|
populateTabbedPaneByHost(selectedHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -154,7 +157,7 @@ public class Databoard extends JPanel {
|
|||||||
if (keyCode == KeyEvent.VK_ENTER) {
|
if (keyCode == KeyEvent.VK_ENTER) {
|
||||||
String selectedItem = hostComboBox.getSelectedItem().toString();
|
String selectedItem = hostComboBox.getSelectedItem().toString();
|
||||||
hostTextField.setText(selectedItem);
|
hostTextField.setText(selectedItem);
|
||||||
populateTabbedPaneByHost(hostComboBox);
|
populateTabbedPaneByHost(selectedItem);
|
||||||
hostComboBox.setPopupVisible(false);
|
hostComboBox.setPopupVisible(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -172,7 +175,6 @@ public class Databoard extends JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
updateList();
|
updateList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -193,12 +195,7 @@ public class Databoard extends JPanel {
|
|||||||
for (String host : getHostByList()) {
|
for (String host : getHostByList()) {
|
||||||
String lowerCaseHost = host.toLowerCase();
|
String lowerCaseHost = host.toLowerCase();
|
||||||
if (lowerCaseHost.contains(input)) {
|
if (lowerCaseHost.contains(input)) {
|
||||||
if (host.length() == input.length()){
|
comboBoxModel.addElement(host);
|
||||||
comboBoxModel.insertElementAt(host,0);
|
|
||||||
comboBoxModel.setSelectedItem(host);
|
|
||||||
} else {
|
|
||||||
comboBoxModel.addElement(host);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -225,9 +222,8 @@ public class Databoard extends JPanel {
|
|||||||
messagePanel.applyHostFilter(filterText);
|
messagePanel.applyHostFilter(filterText);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateTabbedPaneByHost(JComboBox<String> hostComboBox) {
|
private void populateTabbedPaneByHost(String selectedHost) {
|
||||||
if (hostComboBox.getSelectedItem() != null) {
|
if (!Objects.equals(selectedHost, "")) {
|
||||||
String selectedHost = hostComboBox.getSelectedItem().toString();
|
|
||||||
Map<String, Map<String, List<String>>> dataMap = ConfigEntry.globalDataMap;
|
Map<String, Map<String, List<String>>> dataMap = ConfigEntry.globalDataMap;
|
||||||
Map<String, List<String>> selectedDataMap;
|
Map<String, List<String>> selectedDataMap;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import burp.IMessageEditor;
|
|||||||
import burp.IMessageEditorController;
|
import burp.IMessageEditorController;
|
||||||
import burp.config.ConfigEntry;
|
import burp.config.ConfigEntry;
|
||||||
import burp.core.utils.StringHelper;
|
import burp.core.utils.StringHelper;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@@ -46,7 +48,7 @@ public class MessagePanel extends AbstractTableModel implements IMessageEditorCo
|
|||||||
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
||||||
|
|
||||||
logTable = new Table(MessagePanel.this);
|
logTable = new Table(MessagePanel.this);
|
||||||
logTable.setDefaultRenderer(Object.class, new CustomTableCellRenderer(filteredLog, logTable));
|
logTable.setDefaultRenderer(Object.class, new ColorRenderer(filteredLog, logTable));
|
||||||
logTable.setAutoCreateRowSorter(true);
|
logTable.setAutoCreateRowSorter(true);
|
||||||
|
|
||||||
// Length字段根据大小进行排序
|
// Length字段根据大小进行排序
|
||||||
@@ -184,15 +186,18 @@ public class MessagePanel extends AbstractTableModel implements IMessageEditorCo
|
|||||||
byte[] requestByte = requestResponse.getRequest();
|
byte[] requestByte = requestResponse.getRequest();
|
||||||
byte[] responseByte = requestResponse.getResponse();
|
byte[] responseByte = requestResponse.getResponse();
|
||||||
|
|
||||||
|
String requestString = new String(requestResponse.getRequest(), StandardCharsets.UTF_8);
|
||||||
|
String responseString = new String(requestResponse.getResponse(), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
List<String> requestTmpHeaders = helpers.analyzeRequest(requestByte).getHeaders();
|
List<String> requestTmpHeaders = helpers.analyzeRequest(requestByte).getHeaders();
|
||||||
byte[] requestHeaders = helpers.stringToBytes(String.join("\n", requestTmpHeaders));
|
String requestHeaders = new String(String.join("\n", requestTmpHeaders).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
|
||||||
int requestBodyOffset = helpers.analyzeRequest(requestByte).getBodyOffset();
|
int requestBodyOffset = helpers.analyzeRequest(requestByte).getBodyOffset();
|
||||||
byte[] requestBody = Arrays.copyOfRange(requestByte, requestBodyOffset, requestByte.length);
|
String requestBody = new String(Arrays.copyOfRange(requestByte, requestBodyOffset, requestByte.length), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
List<String> responseTmpHeaders = helpers.analyzeResponse(responseByte).getHeaders();
|
List<String> responseTmpHeaders = helpers.analyzeResponse(responseByte).getHeaders();
|
||||||
byte[] responseHeaders = helpers.stringToBytes(String.join("\n", responseTmpHeaders));
|
String responseHeaders = new String(String.join("\n", responseTmpHeaders).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
|
||||||
int responseBodyOffset = helpers.analyzeResponse(responseByte).getBodyOffset();
|
int responseBodyOffset = helpers.analyzeResponse(responseByte).getBodyOffset();
|
||||||
byte[] responseBody = Arrays.copyOfRange(responseByte, responseBodyOffset, responseByte.length);
|
String responseBody = new String(Arrays.copyOfRange(responseByte, responseBodyOffset, responseByte.length), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
final boolean[] isMatched = {false}; // 标志变量,表示是否满足过滤条件
|
final boolean[] isMatched = {false}; // 标志变量,表示是否满足过滤条件
|
||||||
|
|
||||||
@@ -205,31 +210,31 @@ public class MessagePanel extends AbstractTableModel implements IMessageEditorCo
|
|||||||
|
|
||||||
switch (scope) {
|
switch (scope) {
|
||||||
case "any":
|
case "any":
|
||||||
match = helpers.indexOf(requestByte, helpers.stringToBytes(filterText), true, 0, requestByte.length) != -1 || helpers.indexOf(responseByte, helpers.stringToBytes(filterText), true, 0, responseByte.length) != -1;
|
match = requestString.contains(filterText) || responseString.contains(filterText);
|
||||||
break;
|
break;
|
||||||
case "request":
|
case "request":
|
||||||
match = helpers.indexOf(requestByte, helpers.stringToBytes(filterText), true, 0, requestByte.length) != -1;
|
match = requestString.contains(filterText);
|
||||||
break;
|
break;
|
||||||
case "response":
|
case "response":
|
||||||
match = helpers.indexOf(responseByte, helpers.stringToBytes(filterText), true, 0, responseByte.length) != -1;
|
match = responseString.contains(filterText);
|
||||||
break;
|
break;
|
||||||
case "any header":
|
case "any header":
|
||||||
match = helpers.indexOf(requestHeaders, helpers.stringToBytes(filterText), true, 0, requestHeaders.length) != -1 || helpers.indexOf(responseHeaders, helpers.stringToBytes(filterText), true, 0, responseHeaders.length) != -1;
|
match = requestHeaders.contains(filterText) || responseHeaders.contains(filterText);
|
||||||
break;
|
break;
|
||||||
case "request header":
|
case "request header":
|
||||||
match = helpers.indexOf(requestHeaders, helpers.stringToBytes(filterText), true, 0, requestHeaders.length) != -1;
|
match = requestHeaders.contains(filterText);
|
||||||
break;
|
break;
|
||||||
case "response header":
|
case "response header":
|
||||||
match = helpers.indexOf(responseHeaders, helpers.stringToBytes(filterText), true, 0, responseHeaders.length) != -1;
|
match = responseHeaders.contains(filterText);
|
||||||
break;
|
break;
|
||||||
case "any body":
|
case "any body":
|
||||||
match = helpers.indexOf(requestBody, helpers.stringToBytes(filterText), true, 0, requestBody.length) != -1 || helpers.indexOf(responseBody, helpers.stringToBytes(filterText), true, 0, responseBody.length) != -1;
|
match = requestBody.contains(filterText) || responseBody.contains(filterText);
|
||||||
break;
|
break;
|
||||||
case "request body":
|
case "request body":
|
||||||
match = helpers.indexOf(requestBody, helpers.stringToBytes(filterText), true, 0, requestBody.length) != -1;
|
match = requestBody.contains(filterText);
|
||||||
break;
|
break;
|
||||||
case "response body":
|
case "response body":
|
||||||
match = helpers.indexOf(responseBody, helpers.stringToBytes(filterText), true, 0, responseBody.length) != -1;
|
match = responseBody.contains(filterText);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user