Skip to content

Commit

Permalink
GeneratePoC tab にて Burpのバグを対応
Browse files Browse the repository at this point in the history
  • Loading branch information
isayan committed Aug 14, 2021
1 parent d8a26f5 commit a58774c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
Binary file modified release/YaguraExtender-v2.2.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions src/main/java/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public BurpExtender() {
protected static final String LOGGING_PROPERTIES = "/yagura/resources/" + Config.getLoggingPropertyName();

static {
try (ByteArrayOutputStream bout = new ByteArrayOutputStream()) {
try ( ByteArrayOutputStream bout = new ByteArrayOutputStream()) {
Properties prop = new Properties();
File logDir = Config.getExtensionHomeDir();
logDir.mkdirs();
Expand Down Expand Up @@ -891,7 +891,7 @@ public void sendToAddToExcludeScope(IContextMenuInvocation contextMenu, IHttpReq

@Override
public void extensionUnloaded() {

}

}
25 changes: 16 additions & 9 deletions src/main/java/yagura/view/GeneratePoCTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -496,16 +496,27 @@ public void setMessage(byte[] content, boolean isMessageRequest) {
try {
BurpExtender extenderImpl = BurpExtender.getInstance();
String guessCharset = null;
boolean useHttps = false;
HttpRequest request = null;
if (this.controller.getResponse() != null) {
HttpResponse response = HttpResponse.parseHttpResponse(this.controller.getResponse());
guessCharset = response.getGuessCharset();
}
if (isMessageRequest) {
if (this.controller != null) {
request = HttpRequest.parseHttpRequest(content, HttpUtil.isSSL(this.controller.getHttpService().getProtocol()));
IHttpService service = null;
try {
// getHttpService の内部で NullPointerException となるケースがあるバグの対応。
// Burp 2020.8.1 起動直後のRepeterで「Generate PoC」を行うと発生(Pro版のみ)
service = this.controller.getHttpService();
} catch (NullPointerException ex) {
logger.log(Level.WARNING, ex.getMessage(), ex);
}
if (service != null) {
request = HttpRequest.parseHttpRequest(content, HttpUtil.isSSL(service.getProtocol()));
useHttps = HttpUtil.isSSL(service.getProtocol());
} else {
request = HttpRequest.parseHttpRequest(content);
useHttps = request.isSSL();
}
if (guessCharset == null) {
guessCharset = request.getGuessCharset();
Expand All @@ -515,19 +526,15 @@ public void setMessage(byte[] content, boolean isMessageRequest) {
}
this.message = request;
}
if (this.controller != null) {
this.chkUseHttps.setSelected(HttpUtil.isSSL(this.controller.getHttpService().getProtocol()));
} else if (request != null) {
this.chkUseHttps.setSelected(request.isSSL());
} else {
this.chkUseHttps.setSelected(false);
}
this.chkUseHttps.setSelected(useHttps);
this.quickSearchTab.getEncodingComboBox().removeItemListener(encodingItemStateChanged);
this.quickSearchTab.renewEncodingList(guessCharset, extenderImpl.getSelectEncodingList());
encodingItemStateChanged.itemStateChanged(null);
this.quickSearchTab.getEncodingComboBox().addItemListener(encodingItemStateChanged);
} catch (ParseException ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
} catch (Exception ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
}
}

Expand Down

0 comments on commit a58774c

Please sign in to comment.