Skip to content

Commit

Permalink
添加对当分块内容存在不可见字符时不添加注释的判断
Browse files Browse the repository at this point in the history
  • Loading branch information
c0ny1 committed Aug 5, 2021
1 parent 1381419 commit 9168c1c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/burp/Transfer.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ public static byte[] splitReqBody(byte[] reqBody,int minChunkedLen,int maxChunke
List<byte[]> bytes_list = Util.getByteRandomLenList(reqBody,minChunkedLen,maxChunkedLen);
byte[] byte_encoding_body = new byte[0];
for(byte[] b:bytes_list){
if(isComment){
// 当注释开启,同时不存在不可见字符时,才会添加注释
if(isComment && !Util.isIncludeInviChar(reqBody)){
int commentLen = Util.getRandomNum(minCommentLen,maxCommentLen);
String comment = String.format("%s;%s",Util.decimalToHex(b.length),Util.getRandomString(commentLen));
byte_encoding_body = joinByteArray(byte_encoding_body,comment.getBytes());
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/burp/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,24 @@ public static int hexToDecimal(String hex){
}


/**
* 判断数据中是否包含不可见字符
* @param data 要判断的数据
* @return 是否包含不可见字符
*/
public static boolean isIncludeInviChar(byte[] data){
for(int i=0;i<data.length;i++){
int value = Integer.valueOf(data[i]);

if(value < 0 || value > 127){
return true;
}
}

return false;
}


public static void main(String[] args) {
byte[] ewee = "wewewe.w".getBytes();
List<byte[]> xssd = getByteRandomLenList(ewee,1,4);
Expand Down
9 changes: 9 additions & 0 deletions src/main/test/StringTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import burp.Util;

public class StringTest {
public static void main(String[] args) {
String data = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&\\'()*+,-./:;<=>?@[\\\\]^_`{|}~ \\t\\n";
data = "\r\n";
System.out.println(Util.isIncludeInviChar(data.getBytes()));
}
}

0 comments on commit 9168c1c

Please sign in to comment.