Skip to content

Commit

Permalink
u2c v0.7
Browse files Browse the repository at this point in the history
https://support.portswigger.net/customer/en/portal/questions/17364782-a-bug-triggered-when-using-a-imessageeditortab-related-extension
fix a bug in proxy view when switch to "U2C" tab.
修复一个在proxy中会卡死的bug。
  • Loading branch information
bit4woo committed Aug 1, 2018
1 parent 2f936fc commit 3c520a9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.bit4woo.burp</groupId>
<artifactId>u2c</artifactId>
<version>0.6</version>
<version>0.7</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
Expand Down
30 changes: 18 additions & 12 deletions src/U2C/U2CTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
public class U2CTab implements IMessageEditorTab
{
private ITextEditor txtInput;
private IExtensionHelpers helpers;
private byte[] originContent;
public U2CTab(IMessageEditorController controller, boolean editable, IExtensionHelpers helpers, IBurpExtenderCallbacks callbacks)
{
txtInput = callbacks.createTextEditor();
txtInput.setEditable(editable);
this.helpers = helpers;
}

@Override
Expand All @@ -36,8 +35,9 @@ public Component getUiComponent()
@Override
public boolean isEnabled(byte[] content, boolean isRequest)
{
String resp= new String(content);
if(!isRequest && needtoconvert(resp)) {

if(content!=null && !isRequest && needtoconvert(new String(content))) {
originContent = content;
return true;
}else {
return false;
Expand All @@ -48,33 +48,39 @@ public boolean isEnabled(byte[] content, boolean isRequest)
@Override
public void setMessage(byte[] content, boolean isRequest)
{
String resp= new String(content);
String UnicodeResp = "";
if(needtoconvert(resp)) {
UnicodeResp = Unicode.unicodeDecode(resp);
if(content != null) {
String resp= new String(content);
if(needtoconvert(resp)) {
UnicodeResp = Unicode.unicodeDecode(resp);
}
}
txtInput.setText(UnicodeResp.getBytes());
}

@Override
public byte[] getMessage()
{
byte[] text = txtInput.getText();
return text;
//byte[] text = txtInput.getText();
//return text;
return originContent;
//change the return value of getMessage() method to the origin content to tell burp don't change the original response

}

@Override
public boolean isModified()
{
return txtInput.isTextModified();
//return txtInput.isTextModified();
return false;
//change the return value of isModified() method to false. to let burp don't change the original response)
}

@Override
public byte[] getSelectedData()
{
return txtInput.getSelectedText();
}

}


public static boolean needtoconvert(String str) {
Expand Down
2 changes: 1 addition & 1 deletion src/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class BurpExtender implements IBurpExtender,IMessageEditorTabFactory
private IBurpExtenderCallbacks callbacks;
private IExtensionHelpers helpers;

public String ExtenderName = "U2C v0.6 by bit4";
public String ExtenderName = "U2C v0.7 by bit4";
public String github = "https://github.com/bit4woo/U2C";

@Override
Expand Down

0 comments on commit 3c520a9

Please sign in to comment.