Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 9bb45f6

Browse files
author
vaycore
committed
将数据看板界面的复选框状态保存到配置文件;将Disable选项功能更改为Enable
1 parent caef6f1 commit 9bb45f6

File tree

3 files changed

+50
-24
lines changed

3 files changed

+50
-24
lines changed

src/main/java/burp/BurpExtender.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ private void doScan(IHttpRequestResponse httpReqResp, boolean fromProxy) {
180180
// 收集响应包中的Json字段信息
181181
collectJsonField(httpReqResp);
182182
// 检测是否禁用递归扫描
183-
if (!mDataBoardTab.hasDisableDirScan()) {
183+
if (mDataBoardTab.hasDirScan()) {
184184
// 一级目录一级目录递减访问
185185
for (int i = pathDict.size() - 1; i >= 0; i--) {
186186
String path = pathDict.get(i);
@@ -398,7 +398,7 @@ private void doBurpRequest(IHttpRequestResponse httpReqResp, byte[] request) {
398398
}
399399

400400
private byte[] handleExcludeHeader(IHttpRequestResponse httpReqResp, byte[] request) {
401-
boolean state = mDataBoardTab.hasEnableExcludeHeader();
401+
boolean state = mDataBoardTab.hasExcludeHeader();
402402
List<String> excludeHeader = WordlistManager.getExcludeHeader();
403403
if (!state || excludeHeader.isEmpty()) {
404404
return request;
@@ -434,7 +434,7 @@ private String buildRequestHeader(IHttpRequestResponse httpReqResp, String urlPa
434434
// 请求头构造
435435
request.append("GET ").append(urlPath).append(" HTTP/1.1").append("\r\n");
436436
// 如果存在配置并且未禁用替换请求头,直接加载配置的值,否则使用原请求包的请求头
437-
if (!mDataBoardTab.hasDisableHeaderReplace() && headerList.size() > 0) {
437+
if (mDataBoardTab.hasReplaceHeader() && headerList.size() > 0) {
438438
for (String headerItem : headerList) {
439439
int splitIndex = headerItem.indexOf(": ");
440440
if (splitIndex == -1) {

src/main/java/burp/vaycore/onescan/common/Config.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* Created by vaycore on 2022-08-19.
2323
*/
2424
public class Config {
25+
// 配置项
2526
public static final String KEY_VERSION = "version";
2627
public static final String KEY_PAYLOAD_PROCESS_LIST = "payload-process-list";
2728
public static final String KEY_QPS_LIMIT = "qps-limit";
@@ -31,6 +32,11 @@ public class Config {
3132
public static final String KEY_HAE_PLUGIN_PATH = "hae-plugin-path";
3233
public static final String KEY_INCLUDE_METHOD = "include-method";
3334
public static final String KEY_WORDLIST_PATH = "dict-path";
35+
// 首页开关配置项
36+
public static final String KEY_ENABLE_LISTEN_PROXY = "enable-listen-proxy";
37+
public static final String KEY_ENABLE_EXCLUDE_HEADER = "enable-exclude-header";
38+
public static final String KEY_ENABLE_REPLACE_HEADER = "enable-replace-header";
39+
public static final String KEY_ENABLE_DIR_SCAN = "enable-dir-scan";
3440
private static ConfigManager sConfigManager;
3541
private static String sConfigPath;
3642

@@ -48,6 +54,11 @@ public static void init() {
4854
"woff2|xbm|xls|xlsx|xpm|xul|xwd|zip|zip");
4955
initDefaultConfig(Config.KEY_INCLUDE_METHOD, "GET|POST");
5056
initDefaultConfig(Config.KEY_WORDLIST_PATH, getWorkDir() + "wordlist");
57+
// 默认开关配置
58+
initDefaultConfig(Config.KEY_ENABLE_LISTEN_PROXY, "false");
59+
initDefaultConfig(Config.KEY_ENABLE_EXCLUDE_HEADER, "false");
60+
initDefaultConfig(Config.KEY_ENABLE_REPLACE_HEADER, "true");
61+
initDefaultConfig(Config.KEY_ENABLE_DIR_SCAN, "true");
5162
// 初始化字典管理
5263
WordlistManager.init(get(Config.KEY_WORDLIST_PATH));
5364
// 初始化指纹管理
@@ -71,13 +82,12 @@ private static void initFpManager() {
7182

7283
private static void onVersionUpgrade() {
7384
String version = getVersion();
74-
if (!version.equals("1.0.0")) {
75-
putVersion("1.0.0");
85+
if (!version.equals(Constants.PLUGIN_VERSION)) {
86+
putVersion(Constants.PLUGIN_VERSION);
7687
upgradeDomain();
7788
upgradeRemoveHeaderList();
7889
upgradeWordlist();
7990
}
80-
8191
}
8292

8393
private static void upgradeDomain() {
@@ -201,6 +211,12 @@ public static String get(String key) {
201211
return sConfigManager.get(key);
202212
}
203213

214+
public static boolean getBoolean(String key) {
215+
checkInit();
216+
String value = sConfigManager.get(key);
217+
return "true".equals(value);
218+
}
219+
204220
public static ArrayList<String> getList(String key) {
205221
checkInit();
206222
return sConfigManager.getList(key);

src/main/java/burp/vaycore/onescan/ui/tab/DataBoardTab.java

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import burp.vaycore.common.widget.HintTextField;
1111
import burp.vaycore.onescan.bean.FpData;
1212
import burp.vaycore.onescan.bean.TaskData;
13+
import burp.vaycore.onescan.common.Config;
1314
import burp.vaycore.onescan.common.DialogCallbackAdapter;
1415
import burp.vaycore.onescan.manager.FpManager;
1516
import burp.vaycore.onescan.ui.base.BaseTab;
@@ -30,9 +31,9 @@ public class DataBoardTab extends BaseTab {
3031

3132
private TaskTable mTaskTable;
3233
private JCheckBox mListenProxyMessage;
33-
private JCheckBox mEnableExcludeHeader;
34-
private JCheckBox mDisableHeaderReplace;
35-
private JCheckBox mDisableDirScan;
34+
private JCheckBox mExcludeHeader;
35+
private JCheckBox mReplaceHeader;
36+
private JCheckBox mDirScan;
3637
private ArrayList<FilterRule> mLastFilters;
3738
private HintTextField mFilterRuleText;
3839

@@ -83,13 +84,13 @@ public void init(Component requestTextEditor, Component responseTextEditor) {
8384
controlPanel.setLayout(new HLayout(5, true));
8485
add(controlPanel);
8586
// 代理监听开关
86-
mListenProxyMessage = newJCheckBox(controlPanel, "Listen Proxy Message");
87-
// 启用请求头排除开关
88-
mEnableExcludeHeader = newJCheckBox(controlPanel, "Enable ExcludeHeader");
89-
// 禁用请求头替换功能
90-
mDisableHeaderReplace = newJCheckBox(controlPanel, "Disable HeaderReplace");
91-
// 禁用递归扫描功能
92-
mDisableDirScan = newJCheckBox(controlPanel, "Disable DirScan");
87+
mListenProxyMessage = newJCheckBox(controlPanel, "Listen Proxy Message", Config.KEY_ENABLE_LISTEN_PROXY);
88+
// 请求头排除开关
89+
mExcludeHeader = newJCheckBox(controlPanel, "Exclude Header", Config.KEY_ENABLE_EXCLUDE_HEADER);
90+
// 请求头替换开关
91+
mReplaceHeader = newJCheckBox(controlPanel, "Replace Header", Config.KEY_ENABLE_REPLACE_HEADER);
92+
// 递归扫描开关
93+
mDirScan = newJCheckBox(controlPanel, "DirScan", Config.KEY_ENABLE_DIR_SCAN);
9394
// 过滤设置
9495
controlPanel.add(new JPanel(), "1w");
9596
mFilterRuleText = new HintTextField();
@@ -122,11 +123,20 @@ public void init(Component requestTextEditor, Component responseTextEditor) {
122123
add(mainSplitPanel, "100%");
123124
}
124125

125-
private JCheckBox newJCheckBox(JPanel panel, String text) {
126-
JCheckBox checkBox = new JCheckBox(text, false);
126+
private JCheckBox newJCheckBox(JPanel panel, String text, String configKey) {
127+
JCheckBox checkBox = new JCheckBox(text, Config.getBoolean(configKey));
127128
checkBox.setFocusable(false);
128129
checkBox.setMargin(new Insets(5, 5, 5, 5));
129130
panel.add(checkBox);
131+
checkBox.addActionListener(e -> {
132+
boolean configSelected = Config.getBoolean(configKey);
133+
boolean selected = checkBox.isSelected();
134+
if (selected == configSelected) {
135+
return;
136+
}
137+
// 保存配置
138+
Config.put(configKey, String.valueOf(selected));
139+
});
130140
return checkBox;
131141
}
132142

@@ -138,16 +148,16 @@ public boolean hasListenProxyMessage() {
138148
return mListenProxyMessage != null && mListenProxyMessage.isSelected();
139149
}
140150

141-
public boolean hasEnableExcludeHeader() {
142-
return mEnableExcludeHeader != null && mEnableExcludeHeader.isSelected();
151+
public boolean hasExcludeHeader() {
152+
return mExcludeHeader != null && mExcludeHeader.isSelected();
143153
}
144154

145-
public boolean hasDisableHeaderReplace() {
146-
return mDisableHeaderReplace != null && mDisableHeaderReplace.isSelected();
155+
public boolean hasReplaceHeader() {
156+
return mReplaceHeader != null && mReplaceHeader.isSelected();
147157
}
148158

149-
public boolean hasDisableDirScan() {
150-
return mDisableDirScan != null && mDisableDirScan.isSelected();
159+
public boolean hasDirScan() {
160+
return mDirScan != null && mDirScan.isSelected();
151161
}
152162

153163
/**

0 commit comments

Comments
 (0)