2024-05-06 12:56:56 +08:00
|
|
|
|
package hae;
|
|
|
|
|
|
|
|
|
|
|
|
import burp.api.montoya.BurpExtension;
|
|
|
|
|
|
import burp.api.montoya.MontoyaApi;
|
2025-07-29 12:04:21 +08:00
|
|
|
|
import burp.api.montoya.core.BurpSuiteEdition;
|
2024-05-06 12:56:56 +08:00
|
|
|
|
import burp.api.montoya.logging.Logging;
|
2025-05-06 11:24:17 +08:00
|
|
|
|
import hae.cache.DataCache;
|
2024-05-06 12:56:56 +08:00
|
|
|
|
import hae.component.Main;
|
|
|
|
|
|
import hae.component.board.message.MessageTableModel;
|
|
|
|
|
|
import hae.instances.editor.RequestEditor;
|
|
|
|
|
|
import hae.instances.editor.ResponseEditor;
|
|
|
|
|
|
import hae.instances.editor.WebSocketEditor;
|
|
|
|
|
|
import hae.instances.websocket.WebSocketMessageHandler;
|
2024-05-24 15:00:49 +08:00
|
|
|
|
import hae.utils.ConfigLoader;
|
2024-12-21 15:34:45 +08:00
|
|
|
|
import hae.utils.DataManager;
|
2024-05-06 12:56:56 +08:00
|
|
|
|
|
|
|
|
|
|
public class HaE implements BurpExtension {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void initialize(MontoyaApi api) {
|
|
|
|
|
|
// 设置扩展名称
|
2024-12-21 15:34:45 +08:00
|
|
|
|
api.extension().setName("HaE - Highlighter and Extractor");
|
2025-09-22 16:02:06 +08:00
|
|
|
|
String version = "4.3.1";
|
2024-05-06 12:56:56 +08:00
|
|
|
|
|
|
|
|
|
|
// 加载扩展后输出的项目信息
|
|
|
|
|
|
Logging logging = api.logging();
|
|
|
|
|
|
logging.logToOutput("[ HACK THE WORLD - TO DO IT ]");
|
2024-05-30 14:37:01 +08:00
|
|
|
|
logging.logToOutput("[#] Author: EvilChen && 0chencc && vaycore");
|
2024-05-06 12:56:56 +08:00
|
|
|
|
logging.logToOutput("[#] Github: https://github.com/gh0stkey/HaE");
|
2024-12-21 15:34:45 +08:00
|
|
|
|
logging.logToOutput("[#] Version: " + version);
|
2024-05-06 12:56:56 +08:00
|
|
|
|
|
|
|
|
|
|
// 配置文件加载
|
|
|
|
|
|
ConfigLoader configLoader = new ConfigLoader(api);
|
|
|
|
|
|
|
2024-09-19 17:08:46 +08:00
|
|
|
|
MessageTableModel messageTableModel = new MessageTableModel(api, configLoader);
|
2024-05-06 12:56:56 +08:00
|
|
|
|
|
2025-01-08 13:49:12 +08:00
|
|
|
|
// 设置BurpSuite专业版状态
|
2025-07-29 12:04:21 +08:00
|
|
|
|
Config.proVersionStatus = getBurpSuiteProStatus(api);
|
2025-01-08 13:49:12 +08:00
|
|
|
|
|
2024-05-06 12:56:56 +08:00
|
|
|
|
// 注册Tab页(用于查询数据)
|
|
|
|
|
|
api.userInterface().registerSuiteTab("HaE", new Main(api, configLoader, messageTableModel));
|
|
|
|
|
|
|
|
|
|
|
|
// 注册WebSocket处理器
|
2025-05-06 11:24:17 +08:00
|
|
|
|
api.proxy().registerWebSocketCreationHandler(proxyWebSocketCreation -> proxyWebSocketCreation.proxyWebSocket().registerProxyMessageHandler(new WebSocketMessageHandler(api, configLoader)));
|
2024-05-06 12:56:56 +08:00
|
|
|
|
|
|
|
|
|
|
// 注册消息编辑框(用于展示数据)
|
2024-05-23 12:00:13 +08:00
|
|
|
|
api.userInterface().registerHttpRequestEditorProvider(new RequestEditor(api, configLoader));
|
|
|
|
|
|
api.userInterface().registerHttpResponseEditorProvider(new ResponseEditor(api, configLoader));
|
2024-07-23 09:21:30 +08:00
|
|
|
|
api.userInterface().registerWebSocketMessageEditorProvider(new WebSocketEditor(api, configLoader));
|
2024-06-19 22:16:57 +08:00
|
|
|
|
|
2024-12-21 15:34:45 +08:00
|
|
|
|
// 从BurpSuite里加载数据
|
|
|
|
|
|
DataManager dataManager = new DataManager(api);
|
|
|
|
|
|
dataManager.loadData(messageTableModel);
|
|
|
|
|
|
|
2025-03-25 11:44:07 +08:00
|
|
|
|
api.extension().registerUnloadingHandler(() -> {
|
|
|
|
|
|
// 卸载清空数据
|
|
|
|
|
|
Config.globalDataMap.clear();
|
2025-05-06 11:24:17 +08:00
|
|
|
|
DataCache.clear();
|
2024-06-19 22:16:57 +08:00
|
|
|
|
});
|
2024-05-06 12:56:56 +08:00
|
|
|
|
}
|
2025-01-08 13:49:12 +08:00
|
|
|
|
|
2025-07-29 12:04:21 +08:00
|
|
|
|
private Boolean getBurpSuiteProStatus(MontoyaApi api) {
|
2025-01-08 13:49:12 +08:00
|
|
|
|
boolean burpSuiteProStatus = false;
|
2025-07-29 12:04:21 +08:00
|
|
|
|
|
2025-01-08 13:49:12 +08:00
|
|
|
|
try {
|
2025-07-29 12:04:21 +08:00
|
|
|
|
burpSuiteProStatus = api.burpSuite().version().edition() == BurpSuiteEdition.PROFESSIONAL;
|
|
|
|
|
|
} catch (Exception ignored) {
|
2025-01-08 13:49:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return burpSuiteProStatus;
|
|
|
|
|
|
}
|
2024-05-06 12:56:56 +08:00
|
|
|
|
}
|