Fiexd bug: isLoaded

This commit is contained in:
AnonymousUser
2020-10-27 19:00:10 +08:00
parent 1df27ea121
commit edeb263712
3 changed files with 30 additions and 29 deletions

View File

@@ -41,7 +41,7 @@ HaE supports three actions:
3. Color upgrade algorithm: **Two regulars expression, the colors are both orange, if the request are matched these, it will be upgraded to red.**
4. The configuration file format uses JSON format, the format is
```
{name: {"loaded": isLoaded:,"regex": regexText, "highlight": isHighlight, "extract": isExtract, "color": colorText}}
{name: {"loaded": isLoaded,"regex": regexText, "highlight": isHighlight, "extract": isExtract, "color": colorText}}
```
5. Built-in simple cache to reduce the stuttering phenomenon in the `multi-regular, big data scenario`.

View File

@@ -37,7 +37,7 @@ HaE支持三个动作
3. 颜色升级算法利用下标的方式进行优先级排序当满足2个同颜色条件则以优先级顺序上升颜色。例如**两个正则,颜色为橘黄色,该请求两个正则都匹配到了,那么将升级为红色**
4. 简单的配置文件格式选用JSON格式格式为
```
{name: {"loaded": isLoaded:,"regex": regexText, "highlight": isHighlight, "extract": isExtract, "color": colorText}}
{name: {"loaded": isLoaded,"regex": regexText, "highlight": isHighlight, "extract": isExtract, "color": colorText}}
```
5. 内置简单缓存,在“多正则、大数据”的场景下减少卡顿现象。

View File

@@ -271,8 +271,7 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
String name = k.next();
JSONObject jsonObj2 = new JSONObject(jsonObj.get(name).toString());
boolean isHighlight = jsonObj2.getBoolean("highlight");
boolean isLoaded = jsonObj2.getBoolean("loaded");
if (isHighlight && isLoaded) {
if (isHighlight) {
colorList.add(jsonObj2.getString("color"));
}
}
@@ -306,7 +305,7 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
@Override
public boolean isEnabled(byte[] content, boolean isRequest) {
// 这里需要过一次正则匹配决定是否开启Tab
// 先判断是否是请求,再判断是否匹配到内容
if (!isRequest && matchRegex(content).length() != 0) {
return true;
}
@@ -342,9 +341,8 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
String name = k.next();
JSONObject jsonObj1 = new JSONObject(jsonObj.get(name).toString());
boolean isExtract = jsonObj1.getBoolean("extract");
boolean isLoaded = jsonObj1.getBoolean("loaded");
if (isExtract && isLoaded) {
String tmpStr = String.format("[%s] %s \n", name, jsonObj1.getString("data")).intern();
if (isExtract) {
String tmpStr = String.format("[%s]\n%s\n\n", name, jsonObj1.getString("data")).intern();
result += tmpStr;
}
}
@@ -355,6 +353,7 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
}
}
private JSONObject matchRegex(byte[] content) {
JSONObject tabContent = new JSONObject();
// 正则匹配提取内容
@@ -374,7 +373,7 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
boolean isLoaded = jsonObj1.getBoolean("loaded");
String color = jsonObj1.getString("color");
List<String> result = new ArrayList<String>();
if(isLoaded) {
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(contentString);
while (matcher.find()) {
@@ -391,12 +390,14 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
jsonData.put("highlight", isHighligth);
jsonData.put("extract", isExtract);
jsonData.put("color", color);
jsonData.put("data", String.join(",", result));
jsonData.put("data", String.join("\n", result));
jsonData.put("loaded", isLoaded);
// 初始化格式
tabContent.put(name, jsonData);
}
}
}
return tabContent;
} catch (Exception e) {
return new JSONObject();