Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b5027a528 | ||
|
|
c632782bc6 | ||
|
|
503fea6f55 | ||
|
|
db1f8b9cc9 |
@@ -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.**
|
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
|
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, "scope": request/response/any, "action": extract/highlight/any, "color": colorText}}
|
||||||
```
|
```
|
||||||
5. Built-in simple cache to reduce the stuttering phenomenon in the `multi-regular, big data scenario`.
|
5. Built-in simple cache to reduce the stuttering phenomenon in the `multi-regular, big data scenario`.
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ HaE支持三个动作:
|
|||||||
3. 颜色升级算法: 利用下标的方式进行优先级排序,当满足2个同颜色条件则以优先级顺序上升颜色。(例如: **两个正则,颜色为橘黄色,该请求两个正则都匹配到了,那么将升级为红色**)
|
3. 颜色升级算法: 利用下标的方式进行优先级排序,当满足2个同颜色条件则以优先级顺序上升颜色。(例如: **两个正则,颜色为橘黄色,该请求两个正则都匹配到了,那么将升级为红色**)
|
||||||
4. 简单的配置文件格式选用JSON格式,格式为
|
4. 简单的配置文件格式选用JSON格式,格式为
|
||||||
```
|
```
|
||||||
{name: {"loaded": isLoaded,"regex": regexText, "highlight": isHighlight, "extract": isExtract, "color": colorText}}
|
{name: {"loaded": isLoaded,"regex": regexText, "scope": request/response/any, "action": extract/highlight/any, "color": colorText}}
|
||||||
```
|
```
|
||||||
5. 内置简单缓存,在“多正则、大数据”的场景下减少卡顿现象。
|
5. 内置简单缓存,在“多正则、大数据”的场景下减少卡顿现象。
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'net.portswigger.burp.extender:burp-extender-api:1.7.13'
|
compile 'net.portswigger.burp.extender:burp-extender-api:1.7.13'
|
||||||
|
compile 'net.sourceforge.jregex:jregex:1.2_01'
|
||||||
compile 'org.json:json:20200518'
|
compile 'org.json:json:20200518'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ import java.awt.BorderLayout;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import org.json.*;
|
import org.json.*;
|
||||||
|
|
||||||
|
import jregex.Matcher;
|
||||||
|
import jregex.Pattern;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.DefaultCellEditor;
|
import javax.swing.DefaultCellEditor;
|
||||||
@@ -49,10 +50,10 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
private IBurpExtenderCallbacks callbacks;
|
private IBurpExtenderCallbacks callbacks;
|
||||||
private static String configFilePath = "config.json";
|
private static String configFilePath = "config.json";
|
||||||
private static String initFilePath = "init.hae";
|
private static String initFilePath = "init.hae";
|
||||||
private static String initConfigContent = "{\"Email\":{\"loaded\":true,\"highlight\":true,\"regex\":\"([\\\\w-]+(?:\\\\.[\\\\w-]+)*@(?:[\\\\w](?:[\\\\w-]*[\\\\w])?\\\\.)+[\\\\w](?:[\\\\w-]*[\\\\w])?)\",\"extract\":true,\"color\":\"yellow\"}}";
|
private static String initConfigContent = "{\"Email\":{\"loaded\":true,\"scope\":\"response\",\"regex\":\"([\\\\w-]+(?:\\\\.[\\\\w-]+)*@(?:[\\\\w](?:[\\\\w-]*[\\\\w])?\\\\.)+[\\\\w](?:[\\\\w-]*[\\\\w])?)\",\"action\":\"any\",\"color\":\"yellow\"}}";
|
||||||
private static String endColor = "";
|
private static String endColor = "";
|
||||||
private static String[] colorArray = new String[] {"red", "orange", "yellow", "green", "cyan", "blue", "pink", "magenta", "gray"};
|
private static String[] colorArray = new String[] {"red", "orange", "yellow", "green", "cyan", "blue", "pink", "magenta", "gray"};
|
||||||
private static String[] scopeArray = new String[] {"response", "request"};
|
private static String[] scopeArray = new String[] {"any", "response", "request"};
|
||||||
private static String[] actionArray = new String[] {"any", "extract", "highight"};
|
private static String[] actionArray = new String[] {"any", "extract", "highight"};
|
||||||
private static IMessageEditorTab HaETab;
|
private static IMessageEditorTab HaETab;
|
||||||
private static PrintWriter stdout;
|
private static PrintWriter stdout;
|
||||||
@@ -62,7 +63,7 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
{
|
{
|
||||||
this.callbacks = callbacks;
|
this.callbacks = callbacks;
|
||||||
// 设置插件名字和版本
|
// 设置插件名字和版本
|
||||||
String version = "1.4";
|
String version = "1.4.2";
|
||||||
|
|
||||||
callbacks.setExtensionName(String.format("HaE (%s) - Highlighter and Extractor", version));
|
callbacks.setExtensionName(String.format("HaE (%s) - Highlighter and Extractor", version));
|
||||||
|
|
||||||
@@ -355,13 +356,13 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
JSONObject jsonObj = matchRegex(content, "request", "extract");
|
JSONObject jsonObj = matchRegex(content, "request", "extract");
|
||||||
if (jsonObj.length() != 0) {
|
if (jsonObj.length() != 0) {
|
||||||
String result = extractString(jsonObj);
|
String result = extractString(jsonObj);
|
||||||
markInfoText.setText(result.getBytes());
|
markInfoText.setText(result.getBytes());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
JSONObject jsonObj = matchRegex(content, "response", "extract");
|
JSONObject jsonObj = matchRegex(content, "response", "extract");
|
||||||
if (jsonObj.length() != 0) {
|
if (jsonObj.length() != 0) {
|
||||||
String result = extractString(jsonObj);
|
String result = extractString(jsonObj);
|
||||||
markInfoText.setText(result.getBytes());
|
markInfoText.setText(result.getBytes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -412,14 +413,15 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
String color = jsonObj1.getString("color");
|
String color = jsonObj1.getString("color");
|
||||||
List<String> result = new ArrayList<String>();
|
List<String> result = new ArrayList<String>();
|
||||||
|
|
||||||
if(isLoaded && scope.equals(scopeString) && (action.equals(actionString) || action.equals("any"))) {
|
if(isLoaded && (scope.equals(scopeString) || scope.equals("any")) && (action.equals(actionString) || action.equals("any"))) {
|
||||||
Pattern pattern = Pattern.compile(regex);
|
Pattern pattern = new Pattern(regex);
|
||||||
Matcher matcher = pattern.matcher(contentString);
|
Matcher matcher = pattern.matcher(contentString);
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
// 添加匹配数据至list
|
// 添加匹配数据至list
|
||||||
// 强制用户使用()包裹正则
|
// 强制用户使用()包裹正则
|
||||||
result.add(matcher.group(1));
|
result.add(matcher.group(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 去除重复内容
|
// 去除重复内容
|
||||||
HashSet tmpList = new HashSet(result);
|
HashSet tmpList = new HashSet(result);
|
||||||
result.clear();
|
result.clear();
|
||||||
@@ -435,11 +437,11 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return tabContent;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return new JSONObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {}
|
||||||
|
|
||||||
|
return tabContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 214 KiB After Width: | Height: | Size: 698 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 223 KiB |
Reference in New Issue
Block a user