Skip to content

Commit

Permalink
修复右键快捷工具可能不显示的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
kN6jq committed Jan 9, 2024
1 parent 6ae2f4a commit 6f8de7e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.xm17</groupId>
<artifactId>gatherBurp</artifactId>
<version>1.0.4-SNAPSHOT</version>
<version>1.0.5-SNAPSHOT</version>
<packaging>jar</packaging>

<name>gatherBurp</name>
Expand Down
42 changes: 24 additions & 18 deletions src/main/java/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,39 +46,45 @@ public List<JMenuItem> createMenuItems(IContextMenuInvocation iContextMenuInvoca
IHttpRequestResponse baseRequestResponse = iContextMenuInvocation.getSelectedMessages()[0];

List<ConfigBean> toolParam = getToolConfig();

for (ConfigBean config : toolParam) {
if (!Objects.equals(config.getType(), "") && !Objects.equals(config.getValue(), "")) {
listMenuItems.add(new JMenuItem(new AbstractAction(config.getType()) {
String name = config.getType();
String value = config.getValue();
if (!Objects.equals(name, "") && !Objects.equals(value, "")) {
String cmd = value;
if (requestResponses != null) {
if (cmd.contains("{url}")) {
String url = Utils.helpers.analyzeRequest(baseRequestResponse).getUrl().toString();
cmd = cmd.replace("{url}", url);
} else if (cmd.contains("{request}")) {
String requestFilePath = writeReqFile(baseRequestResponse);
assert requestFilePath != null;
cmd = cmd.replace("{request}", requestFilePath);
} else if (cmd.contains("{host}")) {
String host = baseRequestResponse.getHttpService().getHost();
cmd = cmd.replace("{host}", host);
}
}
JMenuItem jMenuItem = new JMenuItem(name);
String finalCmd = cmd;
jMenuItem.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
Runnable toolRunner = new Runnable() {
@Override
public void run() {
try {
RobotInput ri = new RobotInput();
if (requestResponses != null) {
String cmd = config.getValue();
if (cmd.contains("{url}")) {
String url = Utils.helpers.analyzeRequest(baseRequestResponse).getUrl().toString();
cmd = cmd.replace("{url}", url);
} else if (cmd.contains("{request}")) {
String requestFilePath = writeReqFile(baseRequestResponse);
assert requestFilePath != null;
cmd = cmd.replace("{request}", requestFilePath);
} else if (cmd.contains("{host}")) {
String host = baseRequestResponse.getHttpService().getHost();
cmd = cmd.replace("{host}", host);
}
ri.inputString(cmd);
}
ri.inputString(finalCmd);
} catch (Exception e1) {
Utils.stderr.println(e1.getMessage());
}
}
};
new Thread(toolRunner).start();
}
}));
});
listMenuItems.add(jMenuItem);
}
}
JMenu fastjson = new JMenu("FastJson");
Expand Down

0 comments on commit 6f8de7e

Please sign in to comment.