Fixed bug: fucntion colorUpgrade
This commit is contained in:
@@ -49,7 +49,8 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
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,\"highlight\":true,\"regex\":\"([\\\\w-]+(?:\\\\.[\\\\w-]+)*@(?:[\\\\w](?:[\\\\w-]*[\\\\w])?\\\\.)+[\\\\w](?:[\\\\w-]*[\\\\w])?)\",\"extract\":true,\"color\":\"yellow\"}}";
|
||||||
private String[] colorArray = new String[] {"red", "orange", "yellow", "green", "cyan", "blue", "pink", "magenta", "gray"};
|
private static String endColor = "";
|
||||||
|
private static String[] colorArray = new String[] {"red", "orange", "yellow", "green", "cyan", "blue", "pink", "magenta", "gray"};
|
||||||
private static IMessageEditorTab HaETab;
|
private static IMessageEditorTab HaETab;
|
||||||
private static PrintWriter stdout;
|
private static PrintWriter stdout;
|
||||||
|
|
||||||
@@ -276,7 +277,8 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (colorList.size() != 0) {
|
if (colorList.size() != 0) {
|
||||||
String color = colorUpgrade(getColorKeys(colorList));
|
colorUpgrade(getColorKeys(colorList));
|
||||||
|
String color = endColor;
|
||||||
messageInfo.setHighlight(color);
|
messageInfo.setHighlight(color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -422,15 +424,17 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
/*
|
/*
|
||||||
* 颜色升级递归算法
|
* 颜色升级递归算法
|
||||||
*/
|
*/
|
||||||
private String colorUpgrade(List<Integer> colorList) {
|
private static String colorUpgrade(List<Integer> colorList) {
|
||||||
int colorSize = colorList.size();
|
int colorSize = colorList.size();
|
||||||
|
colorList.sort(Comparator.comparingInt(Integer::intValue));
|
||||||
int i = 0;
|
int i = 0;
|
||||||
List<Integer> stack = new ArrayList<Integer>();
|
List<Integer> stack = new ArrayList<Integer>();
|
||||||
while (i < colorSize) {
|
while (i < colorSize) {
|
||||||
if (stack.size() > 0) {
|
if (stack.isEmpty()) {
|
||||||
stack.add(colorList.get(i));
|
stack.add(colorList.get(i));
|
||||||
i++;
|
i++;
|
||||||
} else if (colorList.get(i) != stack.stream().reduce((first, second) -> second).orElse(999999)) {
|
} else {
|
||||||
|
if (colorList.get(i) != stack.stream().reduce((first, second) -> second).orElse(99999999)) {
|
||||||
stack.add(colorList.get(i));
|
stack.add(colorList.get(i));
|
||||||
i++;
|
i++;
|
||||||
} else {
|
} else {
|
||||||
@@ -438,19 +442,17 @@ public class BurpExtender implements IBurpExtender, IHttpListener, IMessageEdito
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int stackSize = stack.size();
|
|
||||||
|
}
|
||||||
// 利用HashSet删除重复元素
|
// 利用HashSet删除重复元素
|
||||||
HashSet tmpList = new HashSet(stack);
|
HashSet tmpList = new HashSet(stack);
|
||||||
stack.clear();
|
if (stack.size() == tmpList.size()) {
|
||||||
stack.addAll(tmpList);
|
stack.sort(Comparator.comparingInt(Integer::intValue));
|
||||||
if (stackSize == stack.size()) {
|
if(stack.get(0).equals(-1)) {
|
||||||
List<String> endColorList = new ArrayList<String>();
|
endColor = colorArray[0];
|
||||||
for (int j = 0; j < stack.size(); j++) {
|
} else {
|
||||||
int num = stack.get(j);
|
endColor = colorArray[stack.get(0)];
|
||||||
endColorList.add(colorArray[num]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return endColorList.get(0);
|
|
||||||
} else {
|
} else {
|
||||||
colorUpgrade(stack);
|
colorUpgrade(stack);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user