This commit is contained in:
鸭王
2021-09-24 20:24:39 +08:00
committed by GitHub
parent e0f6cc657c
commit a294abf590

View File

@@ -37,7 +37,7 @@ public class Utils {
}
//更新header
byte[] newMessage = BurpExtender.helpers.buildHttpMessage(headers, getHttpRequestBody(currentRequest).getBytes());
byte[] newMessage = BurpExtender.helpers.buildHttpMessage(headers, getHttpRequestBody(currentRequest));
currentRequest.setRequest(newMessage);
}
@@ -45,10 +45,6 @@ public class Utils {
public static void addfakeip(IHttpRequestResponse iHttpRequestResponse, String ip) {
byte contentType = BurpExtender.helpers.analyzeRequest(iHttpRequestResponse).getContentType();
if (contentType != CONTENT_TYPE_MULTIPART) {
//获取原请求信息
IRequestInfo requestInfo = BurpExtender.helpers.analyzeRequest(iHttpRequestResponse);
List<String> headers = requestInfo.getHeaders();
@@ -58,25 +54,20 @@ public class Utils {
headers.add(String.format("%s: %s", Config.AUTOXFF_KEY, ip));
//更新header
byte[] newMessage = BurpExtender.helpers.buildHttpMessage(headers, getHttpRequestBody(iHttpRequestResponse).getBytes());
byte[] newMessage = BurpExtender.helpers.buildHttpMessage(headers, getHttpRequestBody(iHttpRequestResponse));
iHttpRequestResponse.setRequest(newMessage);
}
}
private static String getHttpRequestBody(IHttpRequestResponse httpRequestResponse) {
private static byte[] getHttpRequestBody(IHttpRequestResponse httpRequestResponse) {
byte[] request = httpRequestResponse.getRequest();
IRequestInfo requestInfo = BurpExtender.helpers.analyzeRequest(request);
int httpBodyOffset = requestInfo.getBodyOffset();
int httpBodyLength = request.length - httpBodyOffset;
String httpBody = null;
try {
httpBody = new String(request, httpBodyOffset, httpBodyLength, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
byte[] httpBody = new byte[httpBodyLength];
System.arraycopy(request,httpBodyOffset,httpBody,0,httpBodyLength);
return httpBody;
}