Version: 2.0.7 Update

This commit is contained in:
AnonymousUser
2021-09-07 22:09:42 +08:00
parent 62edae0ab4
commit 5c326d3ca6
8 changed files with 53 additions and 75 deletions

View File

@@ -22,7 +22,7 @@ public class DoAction {
}
public List<String> highlightList(Map<String, Map<String, Object>> obj) {
List<String> colorList = new ArrayList<String>();
List<String> colorList = new ArrayList<>();
obj.keySet().forEach(i->{
Map<String, Object> tmpMap = obj.get(i);
String color = tmpMap.get("color").toString();

View File

@@ -1,6 +1,6 @@
package burp.action;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.*;
import dk.brics.automaton.Automaton;
@@ -18,12 +18,11 @@ import burp.yaml.LoadConfigFile;
*/
public class ExtractContent {
private LoadConfigFile lcf = new LoadConfigFile();
private LoadRule lr = new LoadRule(lcf.getConfigPath());
public Map<String, Map<String, Object>> matchRegex(byte[] content, String headers, byte[] body, String scopeString) {
Map<String, Map<String, Object>> map = new HashMap<>(); // 最终返回的结果
Map<String,Object[][]> rules = lr.getConfig();
new LoadRule(LoadConfigFile.getConfigPath());
Map<String,Object[][]> rules = LoadRule.getConfig();
rules.keySet().forEach(i -> {
String matchContent = "";
for (Object[] objects : rules.get(i)) {
@@ -43,11 +42,7 @@ public class ExtractContent {
case "any":
case "request":
case "response":
try {
matchContent = new String(content, "UTF-8").intern();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
matchContent = new String(content, StandardCharsets.UTF_8).intern();
break;
case "request header":
case "response header":
@@ -55,11 +50,7 @@ public class ExtractContent {
break;
case "request body":
case "response body":
try {
matchContent = new String(body, "UTF-8").intern();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
matchContent = new String(body, StandardCharsets.UTF_8).intern();
break;
}
@@ -72,8 +63,8 @@ public class ExtractContent {
result.add(matcher.group(1));
}
} else {
RegExp regexpr = new RegExp(regex);
Automaton auto = regexpr.toAutomaton();
RegExp regexp = new RegExp(regex);
Automaton auto = regexp.toAutomaton();
RunAutomaton runAuto = new RunAutomaton(auto, true);
AutomatonMatcher autoMatcher = runAuto.newMatcher(matchContent);
while (autoMatcher.find()) {

View File

@@ -1,5 +1,6 @@
package burp.action;
import burp.Config;
import java.util.ArrayList;
import java.util.List;
@@ -11,13 +12,14 @@ public class GetColorKey {
/*
* 颜色下标获取
*/
public List<Integer> getColorKeys(List<String> keys, String[] colorArray){
List<Integer> result = new ArrayList<Integer>();
public List<Integer> getColorKeys(List<String> keys){
List<Integer> result = new ArrayList<>();
String[] colorArray = Config.colorArray;
int size = colorArray.length;
// 根据颜色获取下标
for (int x = 0; x < keys.size(); x++) {
for (String key : keys) {
for (int v = 0; v < size; v++) {
if (colorArray[v].equals(keys.get(x))) {
if (colorArray[v].equals(key)) {
result.add(v);
}
}

View File

@@ -15,10 +15,6 @@ public class MatchHTTP {
public boolean matchSuffix(String str) {
Pattern pattern = new Pattern(String.format("[\\w]+[\\.](%s)", lc.getExcludeSuffix()), REFlags.IGNORE_CASE);
Matcher matcher = pattern.matcher(str);
if(matcher.find()){
return true;
}else{
return false;
}
return matcher.find();
}
}

View File

@@ -1,9 +1,8 @@
package burp.action;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import burp.Config;
import java.util.*;
/*
* @author EvilChen
@@ -14,43 +13,40 @@ public class UpgradeColor {
/*
* 颜色升级递归算法
*/
private String colorUpgrade(List<Integer> colorList, String[] colorArray) {
private void colorUpgrade(List<Integer> colorList) {
int colorSize = colorList.size();
String[] colorArray = Config.colorArray;
colorList.sort(Comparator.comparingInt(Integer::intValue));
int i = 0;
List<Integer> stack = new ArrayList<Integer>();
List<Integer> stack = new ArrayList<>();
while (i < colorSize) {
if (stack.isEmpty()) {
stack.add(colorList.get(i));
i++;
} else {
if (colorList.get(i) != stack.stream().reduce((first, second) -> second).orElse(99999999)) {
if (!Objects.equals(colorList.get(i), stack.stream().reduce((first, second) -> second).orElse(99999999))) {
stack.add(colorList.get(i));
i++;
} else {
stack.set(stack.size() - 1, stack.get(stack.size() - 1) - 1);
i++;
}
}
i++;
}
// 利用HashSet删除重复元素
HashSet tmpList = new HashSet(stack);
if (stack.size() == tmpList.size()) {
stack.sort(Comparator.comparingInt(Integer::intValue));
if(stack.get(0).equals(-1)) {
if(stack.get(0) < 0) {
this.endColor = colorArray[0];
} else {
this.endColor = colorArray[stack.get(0)];
}
} else {
this.colorUpgrade(stack, colorArray);
this.colorUpgrade(stack);
}
return "";
}
public String getEndColor(List<Integer> colorList, String[] colorArray) {
colorUpgrade(colorList, colorArray);
public String getEndColor(List<Integer> colorList) {
colorUpgrade(colorList);
return endColor;
}
}