Skip to content

Commit

Permalink
0.4.22 请求消息|响应消息 二合一面板
Browse files Browse the repository at this point in the history
  • Loading branch information
winezer0 committed Aug 5, 2024
1 parent 23272b1 commit 6cd888d
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.gv7.tools.burpextend</groupId>
<artifactId>passive-scan-client</artifactId>
<version>0.4.21-jdk8</version>
<version>0.4.22-jdk8</version>

<dependencies>
<!-- https://mvnrepository.com/artifact/net.portswigger.burp.extender/burp-extender-api -->
Expand Down
65 changes: 50 additions & 15 deletions src/main/java/burp/GUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ public class GUI implements ITab,IMessageEditorController {
public static JLabel lbSuccessCount;
public static JLabel lbFailCount;

public static IMessageEditor requestViewer;
public static IMessageEditor responseViewer;
public static IMessageEditor proxyRspViewer;
private static JSplitPane OriginalMsgViewerPane; //请求消息|响应消息 二合一 面板
public static IMessageEditor originalRequestViewer;
public static IMessageEditor originalResponseViewer;

private static JSplitPane proxyMsgViewerPane; //请求消息|响应消息 二合一 面板
public static IMessageEditor proxyRequestViewer;
public static IMessageEditor proxyResponseViewer;

public GUI(IBurpExtenderCallbacks burpExtenderCallbacks, String tabName) {
//设置插件名称
Expand Down Expand Up @@ -220,7 +224,7 @@ public void stateChanged(ChangeEvent arg0) {

//增加显示转发响应结果的内容开关
btnIgnore = new JToggleButton("IGNORE");
btnIgnore.setToolTipText("忽略显示转发到代理服务器时的响应");
btnIgnore.setToolTipText("忽略保存转发到代理服务器时的响应");
btnIgnore.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent arg0) {
boolean isSelected = btnIgnore.isSelected();
Expand Down Expand Up @@ -291,9 +295,12 @@ public void actionPerformed(ActionEvent e) {
BurpExtender.log.clear();
logTable.getHttpLogTableModel().fireTableDataChanged();//通知模型更新
logTable.updateUI();//刷新表格
requestViewer.setMessage("".getBytes(),true);
responseViewer.setMessage("".getBytes(),false);
proxyRspViewer.setMessage("".getBytes(),false);

proxyRequestViewer.setMessage("".getBytes(),true);
originalRequestViewer.setMessage("".getBytes(),true);

proxyResponseViewer.setMessage("".getBytes(),false);
originalResponseViewer.setMessage("".getBytes(),false);
clearHashSet(); //新增URL去重
}
}
Expand Down Expand Up @@ -553,14 +560,23 @@ public void actionPerformed(ActionEvent e) {

//添加最后的响应信息面板
JTabbedPane tabs = new JTabbedPane();
requestViewer = BurpExtender.callbacks.createMessageEditor(this, false);
responseViewer = BurpExtender.callbacks.createMessageEditor(this, false);
//proxyRspViewer = BurpExtender.callbacks.createTextEditor();
proxyRspViewer = BurpExtender.callbacks.createMessageEditor(this, false);

tabs.addTab("Request", requestViewer.getComponent());
tabs.addTab("Original response", responseViewer.getComponent());
tabs.addTab("Proxy response",proxyRspViewer.getComponent());
proxyRequestViewer = BurpExtender.callbacks.createMessageEditor(this, false);
proxyResponseViewer = BurpExtender.callbacks.createMessageEditor(this, false);

originalRequestViewer = BurpExtender.callbacks.createMessageEditor(this, false);
originalResponseViewer = BurpExtender.callbacks.createMessageEditor(this, false);

//添加请求和响应信息面板到一个面板中
proxyMsgViewerPane = new JSplitPane(1);
proxyMsgViewerPane.setLeftComponent(proxyRequestViewer.getComponent());
proxyMsgViewerPane.setRightComponent(proxyResponseViewer.getComponent());

OriginalMsgViewerPane = new JSplitPane(1);
OriginalMsgViewerPane.setLeftComponent(originalRequestViewer.getComponent());
OriginalMsgViewerPane.setRightComponent(originalResponseViewer.getComponent());

tabs.addTab("ProxyMsg", proxyMsgViewerPane);
tabs.addTab("Original", OriginalMsgViewerPane);
splitPane.setBottomComponent(tabs);

burpExtenderCallbacks.customizeUiComponent(topPanel);
Expand Down Expand Up @@ -659,4 +675,23 @@ private void clearHashSet(){
Utils.showStdoutMsg(0, String.format("[*] Clear HashSet By Button, HashMap Size %s --> %s.",HashMapSizeBefore, HashMapSizeAfter));
}

/**
* 当左边极小时 设置请求体和响应体各占一半空间
*/
public static void msgViewerAutoSetSplitCenter(JSplitPane msgViewerPane) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
if (msgViewerPane.getLeftComponent().getWidth() <= 20)
msgViewerPane.setDividerLocation(msgViewerPane.getParent().getWidth() / 2);
}
});
}

public static void proxyMsgViewerAutoSetSplitCenter(){
msgViewerAutoSetSplitCenter(proxyMsgViewerPane);
}

public static void originalMsgViewerAutoSetSplitCenter() {
msgViewerAutoSetSplitCenter(OriginalMsgViewerPane);
}
}
12 changes: 9 additions & 3 deletions src/main/java/burp/HttpLogTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ public void changeSelection(int row, int col, boolean toggle, boolean extend) {
super.changeSelection(row, col, toggle, extend);
//show the log entry for the selected row
LogEntry logEntry = BurpExtender.log.get(row);
GUI.requestViewer.setMessage(logEntry.requestResponse.getRequest(), true);
GUI.responseViewer.setMessage(logEntry.requestResponse.getResponse(), false);
GUI.proxyRspViewer.setMessage(logEntry.proxyResponse, false);

//自动设置请求响应宽度
GUI.proxyMsgViewerAutoSetSplitCenter();
GUI.originalMsgViewerAutoSetSplitCenter();

GUI.proxyRequestViewer.setMessage(logEntry.requestResponse.getRequest(), true);
GUI.proxyResponseViewer.setMessage(logEntry.proxyResponse, false);
GUI.originalRequestViewer.setMessage(logEntry.requestResponse.getRequest(), true);
GUI.originalResponseViewer.setMessage(logEntry.requestResponse.getResponse(), false);
GUI.currentlyDisplayedItem = logEntry.requestResponse;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/psc.config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
EXTENSION_NAME: "PSC"
VERSION: "0.4.20"
VERSION: "0.4.22"
PROXY_HOST: "127.0.0.1"
PROXY_PORT: 7777
PROXY_USERNAME: ""
Expand Down

0 comments on commit 6cd888d

Please sign in to comment.