Skip to content

Commit 1db726d

Browse files
authored
Merge pull request #3 from Chave0v0/dev
完成基本功能开发
2 parents 992c854 + c9076be commit 1db726d

File tree

30 files changed

+765
-157
lines changed

30 files changed

+765
-157
lines changed

.idea/API-Highlighter.iml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/Maven__com_jgoodies_forms_1_2_1.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,5 @@
5656
<version>1.18.30</version>
5757
</dependency>
5858

59-
<dependency>
60-
<groupId>com.jgoodies</groupId>
61-
<artifactId>forms</artifactId>
62-
<version>1.2.1</version>
63-
</dependency>
64-
6559
</dependencies>
6660
</project>

src/main/java/com/chave/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public void initialize(MontoyaApi montoyaApi) {
2121
// 初始化ui
2222
MainUI ui = new MainUI(montoyaApi);
2323
API.userInterface().registerSuiteTab("API Highlighter", ui.getMainPanel());
24-
API.http().registerHttpHandler(new APIHighLighterHandler(montoyaApi));
24+
API.http().registerHttpHandler(new APIHighLighterHandler());
2525
}
2626
}
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
package com.chave.config;
22

33
import com.chave.pojo.APIItem;
4-
54
import java.util.ArrayList;
65
import java.util.HashMap;
76

87
public class APIConfig {
98
public static ArrayList<APIItem> TARGET_API = new ArrayList<>();
10-
public static ArrayList<String> USER_INPUT_API = new ArrayList<>();
119

12-
// 初始化一些测试数据
10+
public static final HashMap ITEM_FIELD = new HashMap();
11+
1312
static {
14-
TARGET_API.add(new APIItem("GET", "/test"));
15-
TARGET_API.add(new APIItem("GET", "/api/v1/{id}/info"));
16-
TARGET_API.add(new APIItem("GET", "/api/v1/{id}/product/{name}"));
13+
ITEM_FIELD.put(0, "method");
14+
ITEM_FIELD.put(1, "path");
15+
ITEM_FIELD.put(2, "result");
16+
ITEM_FIELD.put(3, "state");
17+
ITEM_FIELD.put(4, "note");
18+
ITEM_FIELD.put(5, "domain");
1719
}
20+
1821
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.chave.config;
2+
3+
public class Color {
4+
public static String NONE = "None";
5+
public static String RED = "Red";
6+
public static String ORANGE = "Orange";
7+
public static String YELLOW = "Yellow";
8+
public static String GREEN = "Green";
9+
public static String CYAN ="Cyan";
10+
public static String BLUE = "Blue";
11+
public static String PINK = "Pink";
12+
public static String MAGENTA = "Magenta";
13+
public static String GRAY = "Gray";
14+
}

src/main/java/com/chave/config/UserConfig.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
public class UserConfig {
66
public static MatchMod MATCH_MOD = MatchMod.exactMatch;
7-
public static Boolean IS_REGULAR_REPLACE = Boolean.FALSE;
87
public static Boolean IS_URL_ENCODE = Boolean.FALSE;
8+
public static Boolean IS_CHECK_ENTIRE_REQUEST = Boolean.FALSE;
9+
public static Boolean IS_CHECK_HTTP_METHOD = Boolean.FALSE;
10+
public static Boolean IS_ANALYZE_PATHVARIABLE = Boolean.FALSE;
911
}

src/main/java/com/chave/handler/APIHighLighterHandler.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
package com.chave.handler;
22

3-
import burp.api.montoya.MontoyaApi;
43
import burp.api.montoya.http.handler.*;
4+
import burp.api.montoya.http.message.requests.HttpRequest;
55
import burp.api.montoya.logging.Logging;
6+
import com.chave.Main;
67
import com.chave.config.UserConfig;
78
import com.chave.service.APIMatchService;
8-
9+
import com.chave.utils.Util;
910
import java.lang.reflect.Method;
1011

1112
public class APIHighLighterHandler implements HttpHandler {
12-
private MontoyaApi api;
1313
private Logging log;
1414
private APIMatchService apiMatchService;
1515

16-
public APIHighLighterHandler(MontoyaApi api) {
17-
this.api = api;
18-
this.log = api.logging();
16+
public APIHighLighterHandler() {
17+
this.log = Main.API.logging();
1918
this.apiMatchService = new APIMatchService();
2019
}
2120

2221
@Override
2322
public RequestToBeSentAction handleHttpRequestToBeSent(HttpRequestToBeSent requestToBeSent) {
2423
try {
25-
Method matchMethod = APIMatchService.class.getMethod(UserConfig.MATCH_MOD.name(), HttpRequestToBeSent.class);
24+
Method matchMethod = APIMatchService.class.getMethod(UserConfig.MATCH_MOD.name(), HttpRequest.class);
2625
if ((Boolean) matchMethod.invoke(apiMatchService, requestToBeSent)) {
2726
// 处理匹配到的逻辑
2827
log.logToOutput("匹配到接口:" + requestToBeSent.path());
28+
29+
// 匹配到进行高亮处理
30+
Util.setHighlightColor(requestToBeSent, com.chave.config.Color.YELLOW);
31+
32+
33+
// 后续这里可以添加HaE匹配规则
34+
2935
}
36+
37+
3038
} catch (Exception e) {
3139
log.logToError(e);
3240
}

0 commit comments

Comments
 (0)