Skip to content

Commit

Permalink
modify Match and Replace のContent-Length更新
Browse files Browse the repository at this point in the history
  • Loading branch information
isayan committed May 28, 2024
1 parent eda40cf commit 68cc5de
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Binary file modified libs/BurpExtensionCommons-v3.2.0.0-all.jar
Binary file not shown.
Binary file modified release/YaguraExtension-v3.1.jar
Binary file not shown.
7 changes: 4 additions & 3 deletions src/main/java/burp/BurpExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,7 @@ private ProxyRequestReceivedAction processProxyMessage(InterceptedRequest interc
// Match and Replace
if (getProperty().getMatchReplaceProperty().isSelectedMatchReplace()) {
MatchReplaceGroup group = getProperty().getMatchReplaceProperty().getReplaceSelectedGroup(getProperty().getMatchReplaceProperty().getSelectedName());
BurpExtension.helpers().outPrintln("rbody:\r\n" + StringUtil.getBytesRawString(requestBytes) + "\r\n:rbody");
if (group != null && group.isInScopeOnly()) {
if (helpers().isInScope(interceptedHttpRequest.url())) {
resultBytes = this.replaceProxyMessage(true, requestBytes, interceptedHttpRequest.bodyOffset());
Expand All @@ -1618,9 +1619,9 @@ private ProxyRequestReceivedAction processProxyMessage(InterceptedRequest interc
}
}
if (requestBytes != resultBytes) {
// HttpRequest modifyRequest = HttpRequest.httpRequest(interceptedHttpRequest.httpService(), ByteArray.byteArray(resultBytes));
HttpRequest modifyRequest = ExtensionHelper.httpRequest(interceptedHttpRequest.httpService(), ByteArray.byteArray(resultBytes));
return ProxyRequestReceivedAction.continueWith(modifyRequest, annotations);
HttpRequestWapper wrapModifyRequest = new HttpRequestWapper(modifyRequest);
return ProxyRequestReceivedAction.continueWith(wrapModifyRequest.withUpdateContentLength(), annotations);
} else {
return ProxyRequestReceivedAction.continueWith(interceptedHttpRequest, annotations);
}
Expand Down Expand Up @@ -1749,7 +1750,7 @@ private HttpRequestResponse matchAlertMessage(ToolType toolType, boolean message
* @param bodyOffset
* @return 変換後メッセージ
*/
protected byte[] replaceProxyMessage(
protected synchronized byte[] replaceProxyMessage(
boolean messageIsRequest,
byte[] httpMessage,
int bodyOffset) {
Expand Down

0 comments on commit 68cc5de

Please sign in to comment.