Skip to content

Commit

Permalink
TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
bit4woo committed Apr 21, 2024
1 parent a557958 commit cb02d60
Show file tree
Hide file tree
Showing 10 changed files with 195 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Deprecated/InsertXSSMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
import org.json.JSONException;
import org.json.JSONObject;

import U2C.CharSetHelper;
import burp.BurpExtender;
import burp.Getter;
import burp.IBurpExtenderCallbacks;
import burp.IContextMenuInvocation;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.IParameter;
import messageTab.U2C.CharSetHelper;


@Deprecated
Expand Down
2 changes: 1 addition & 1 deletion src/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.google.gson.Gson;

import U2C.ChineseTabFactory;
import config.ConfigManager;
import config.ConfigEntry;
import config.ConfigTable;
Expand All @@ -37,6 +36,7 @@
import knife.UpdateCookieMenu;
import knife.UpdateCookieWithHistoryMenu;
import knife.UpdateHeaderMenu;
import messageTab.U2C.ChineseTabFactory;
import config.ProcessManager;
import org.apache.commons.lang3.StringUtils;

Expand Down
2 changes: 1 addition & 1 deletion src/knife/CustomPayloadForAllInsertpointMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.json.JSONException;
import org.json.JSONObject;

import U2C.CharSetHelper;
import burp.BurpExtender;
import burp.Getter;
import burp.IBurpExtenderCallbacks;
Expand All @@ -27,6 +26,7 @@
import burp.IParameter;
import burp.Methods;
import config.ConfigEntry;
import messageTab.U2C.CharSetHelper;

/**
* 将某个payload插入所有的插入点,比如XSS
Expand Down
2 changes: 1 addition & 1 deletion src/knife/OpenWithBrowserMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

import javax.swing.JMenuItem;

import U2C.CharSetHelper;
import burp.BurpExtender;
import burp.Getter;
import burp.IBurpExtenderCallbacks;
import burp.IContextMenuInvocation;
import burp.IExtensionHelpers;
import burp.IHttpRequestResponse;
import burp.Utils;
import messageTab.U2C.CharSetHelper;

public class OpenWithBrowserMenu extends JMenuItem {
/**
Expand Down
25 changes: 25 additions & 0 deletions src/messageTab/Info/InfoGrepper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package messageTab.Info;

import burp.BurpExtender;
import burp.HelperPlus;

public class InfoGrepper {

public InfoGrepper(byte[] content, boolean isRequest) {
HelperPlus getter = new HelperPlus(BurpExtender.getCallbacks().getHelpers());

byte[] body = getter.getBody(isRequest, content);

if (body!= null) {
String bodyStr = new String(body);

}

}


public InfoGrepper(String content, boolean isRequest) {

}

}
132 changes: 132 additions & 0 deletions src/messageTab/Info/InfoTab.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
package messageTab.Info;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import org.apache.commons.text.StringEscapeUtils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;

import burp.Getter;
import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IMessageEditorController;
import burp.IMessageEditorTab;
import burp.IRequestInfo;
import burp.IResponseInfo;
import burp.ITextEditor;

/**
* @author bit4woo
* @github https://github.com/bit4woo
* @version CreateTime:2022年1月15日 下午11:07:59
*
* 想要正确显示中文内容,有三个编码设置会影响结果:
* 1、原始编码,通过代码尝试自动获取,但是结果可能不准确,极端情况下需要手动设置。
* 2、转换后的编码,手动设置。
* 3、burp设置的显示编码,显示时时用的编码,应该和转换后的编码一致。
*
* 原始数据是byte[],但也是文本内容的某种编码的byte[].
*
*/
public class InfoTab implements IMessageEditorTab{
private JPanel panel;

private byte[] originContent;

private static IExtensionHelpers helpers;

public InfoTab(IMessageEditorController controller, boolean editable, IExtensionHelpers helpers, IBurpExtenderCallbacks callbacks)
{
panel = createpanel();
InfoTab.helpers = helpers;
}


public JPanel createpanel() {

JPanel contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));

return contentPane;
}

@Override
public String getTabCaption()
{
return "Info";
}

@Override
public Component getUiComponent()
{
return panel;
}

@Override
public boolean isEnabled(byte[] content, boolean isRequest)
{
return true;
}

@Override
public void setMessage(byte[] content, boolean isRequest)
{
originContent = content;

}


/**
* 中文下的编辑还是有问题,暂不支持。
* 始终返回原始内容。
*/
@Override
public byte[] getMessage()
{
return originContent;
}

@Override
public boolean isModified()
{
return false;
}

@Override
public byte[] getSelectedData()
{
return null;//TODO
}

public static boolean isJSON(byte[] content,boolean isRequest) {
if (isRequest) {
IRequestInfo requestInfo = helpers.analyzeRequest(content);
return requestInfo.getContentType() == IRequestInfo.CONTENT_TYPE_JSON;
} else {
IResponseInfo responseInfo = helpers.analyzeResponse(content);
return responseInfo.getInferredMimeType().equals("JSON");
}
}


public static void main(String[] args) {
String aaa = "STK_7411642209636022({\"errno\":1003,\"errmsg\":\"\\u7528\\u6237\\u672a\\u767b\\u5f55\",\"errmsg_lang\":{\"zh\":\"\\u7528\\u6237\\u672a\\u767b\\u5f55\",\"en\":\"User is not logged in.\",\"zh-HK\":\"\\u7528\\u6236\\u672a\\u767b\\u9304\"},\"data\":null});";
System.out.println(StringEscapeUtils.unescapeJava(aaa));
}
}
31 changes: 31 additions & 0 deletions src/messageTab/Info/InfoTabFactory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package messageTab.Info;

import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
import burp.IMessageEditorController;
import burp.IMessageEditorTab;
import burp.IMessageEditorTabFactory;

/**
* 工厂类,构造一个个的Tab实例
* @author bit4woo
* @github https://github.com/bit4woo
*
*/
public class InfoTabFactory implements IMessageEditorTabFactory
{
private static IExtensionHelpers helpers;
private static IBurpExtenderCallbacks callbacks;


public InfoTabFactory(IMessageEditorController controller, boolean editable, IExtensionHelpers helpers, IBurpExtenderCallbacks callbacks)
{
InfoTabFactory.callbacks = callbacks;
InfoTabFactory.helpers = helpers;
}

@Override
public IMessageEditorTab createNewInstance(IMessageEditorController controller, boolean editable) {
return new InfoTab(controller,editable,helpers,callbacks);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package U2C;
package messageTab.U2C;

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package U2C;
package messageTab.U2C;

import java.awt.BorderLayout;
import java.awt.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package U2C;
package messageTab.U2C;

import burp.IBurpExtenderCallbacks;
import burp.IExtensionHelpers;
Expand Down

0 comments on commit cb02d60

Please sign in to comment.