Skip to content

Commit f2f667e

Browse files
committed
Added feature which makes it possible to choose within context menu whether information (e.g. HTTP-Headers, HTTP-Body, HTTP-Message) should be taken from request or response.
1 parent f4bfa2a commit f2f667e

33 files changed

+530
-443
lines changed

BappDescription.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
<li><strong>Command:</strong> the command to be executed. You can use following placeholders:
1313

14-
15-
<ul>
14+
<ul>
1615
<li><strong>%H:</strong> will be replaced with the host</li>
1716

1817
<li><strong>%P:</strong> will be replaced with the port</li>
@@ -31,15 +30,14 @@
3130

3231
<li><strong>%S:</strong> will be replaced with the selected text</li>
3332

34-
<li><strong>%F:</strong> will be replaced with the path to a temporary file containing the selected text</li></ul>
33+
<li><strong>%F:</strong> will be replaced with the path to a temporary file containing the selected text</li>
3534

3635
<li><strong>%R:</strong> will be replaced with the path to a temporary file containing the content of the focused request/response</li>
3736

38-
3937
<li><strong>%E:</strong> will be replaced with the path to a temporary file containing the header of the focused request/response</li>
4038

4139
<li><strong>%B:</strong> will be replaced with the path to a temporary file containing the body of the focused request/response</li>
42-
</li>
40+
</ul>
4341

4442
<li><strong>Run in terminal:</strong> defines whether a terminal-window should appear in which the configured command is executed. By default "xterm" is used as terminal-emulator. You can change the terminal-emulator in the "Miscellaneous Options" to your liking.</li>
4543

BappManifest.bmf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ Uuid: f089f1ad056545489139cb9f32900f8e
22
ExtensionType: 1
33
Name: Custom Send To
44
RepoName: custom-send-to
5-
ScreenVersion: 1.0
5+
ScreenVersion: 1.1
66
SerialVersion: 1
77
MinPlatformVersion: 0
88
ProOnly: False
99
Author: Thomas Engel
1010
ShortDescription: Add a customizable "Send to..." menu to the context menu
11-
EntryPoint: burp-send-to-extension/build/libs/burp-send-to-extension-1.0.jar
11+
EntryPoint: burp-send-to-extension/build/libs/burp-send-to-extension-1.1.jar
1212
BuildCommand: cd burp-send-to-extension; ./gradlew fatJar

burp-send-to-extension/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apply plugin: 'java'
22

33
group 'net.bytebutcher'
4-
version '1.0'
4+
version '1.1'
55

66
sourceCompatibility = 1.8
77

burp-send-to-extension/src/main/java/burp/BurpExtender.java

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,48 @@
44
import net.bytebutcher.burpsendtoextension.gui.SendToTab;
55
import net.bytebutcher.burpsendtoextension.gui.SendToTable;
66
import net.bytebutcher.burpsendtoextension.models.Config;
7-
import net.bytebutcher.burpsendtoextension.utils.OsUtils;
87

98
import javax.swing.*;
109
import java.awt.*;
11-
import java.io.File;
1210
import java.io.PrintWriter;
1311

1412
public class BurpExtender implements IBurpExtender, ITab {
1513

1614
private JPanel tab = null;
17-
private SendToTab sendToTab = null;
18-
private IBurpExtenderCallbacks callbacks;
1915
private SendToContextMenu sendToContextMenu;
20-
private Config config;
2116
private SendToTable sendToTable;
2217

18+
private static IBurpExtenderCallbacks callbacks;
19+
private static Config config;
20+
private static SendToTab sendToTab = null;
21+
2322
private static PrintWriter stdout;
2423
private static PrintWriter stderr;
2524

2625
@Override
2726
public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
28-
this.callbacks = callbacks;
27+
BurpExtender.callbacks = callbacks;
2928
initLogHandler(callbacks);
3029
BurpExtender.printOut("Initializing Send to Extension...");
31-
this.callbacks.setExtensionName("Send to");
30+
BurpExtender.callbacks.setExtensionName("Send to");
3231
BurpExtender.printOut("Initializing config...");
33-
this.config = new Config(this);
32+
BurpExtender.config = new Config(this);
3433
BurpExtender.printOut("Initializing tab...");
35-
this.sendToTab = new SendToTab(this);
34+
BurpExtender.sendToTab = new SendToTab(this);
3635
BurpExtender.printOut("Registering context menu...");
37-
this.sendToContextMenu = new SendToContextMenu(this, this.sendToTab.getSendToTableListener());
38-
this.callbacks.registerContextMenuFactory(sendToContextMenu);
36+
this.sendToContextMenu = new SendToContextMenu(this, sendToTab.getSendToTableListener());
37+
BurpExtender.callbacks.registerContextMenuFactory(sendToContextMenu);
3938
this.tab = sendToTab.getRootPanel();
4039
BurpExtender.printOut("Loading table data...");
41-
this.sendToTable = this.sendToTab.getSendToTable();
42-
this.sendToTable.addCommandObjects(this.config.getSendToTableData());
40+
this.sendToTable = sendToTab.getSendToTable();
41+
this.sendToTable.addCommandObjects(config.getSendToTableData());
4342
callbacks.addSuiteTab(this);
4443
BurpExtender.printOut("----------------------------------------------------------------------");
4544
}
4645

4746
private void initLogHandler(IBurpExtenderCallbacks callbacks) {
48-
this.stderr = new PrintWriter(callbacks.getStderr(), true);
49-
this.stdout = new PrintWriter(callbacks.getStdout(), true);
47+
stderr = new PrintWriter(callbacks.getStderr(), true);
48+
stdout = new PrintWriter(callbacks.getStdout(), true);
5049
}
5150

5251
@Override
@@ -71,16 +70,16 @@ public ImageIcon createImageIcon(String path, String description, int width, int
7170
}
7271
}
7372

74-
public Config getConfig() {
75-
return this.config;
73+
public static JFrame getParent() {
74+
return sendToTab.getParent();
7675
}
7776

78-
public JFrame getParent() {
79-
return this.sendToTab.getParent();
77+
public static IBurpExtenderCallbacks getCallbacks() {
78+
return callbacks;
8079
}
8180

82-
public IBurpExtenderCallbacks getCallbacks() {
83-
return this.callbacks;
81+
public static Config getConfig() {
82+
return config;
8483
}
8584

8685
public static void printOut(String s) {

burp-send-to-extension/src/main/java/net/bytebutcher/burpsendtoextension/gui/SendToAddDialog.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public SendToAddDialog(JFrame parent, String title, java.util.List<CommandObject
4141
this(parent, title, commandObjects);
4242
commandObjects.remove(commandObject);
4343
txtName.setText(commandObject.getName());
44-
txtCommand.setText(commandObject.getCommand());
44+
txtCommand.setText(commandObject.getFormat());
4545
txtGroup.setText(commandObject.getGroup());
4646
chkShowPreviewPriorToExecution.setSelected(commandObject.shouldShowPreview());
4747
chkRunInBackground.setSelected(commandObject.shouldRunInBackground());
@@ -114,9 +114,9 @@ public void actionPerformed(ActionEvent e) {
114114
"<p>%M = HTTP-Method</p>" +
115115
"<p>%S = Selected text</p>" +
116116
"<p>%F = Path to file containing selected text</p>" +
117-
"<p>%R = Path to file containing focused HTTP-request/-response</p>" +
118-
"<p>%B = Path to file containing HTTP-body of focused request/response</p>" +
119-
"<p>%E = Path to file containing HTTP-header of focused request/response</p>" +
117+
"<p>%R = Path to file containing HTTP-request/-response</p>" +
118+
"<p>%B = Path to file containing body of HTTP-request/-response</p>" +
119+
"<p>%E = Path to file containing header of HTTP-request/-response</p>" +
120120
"</html>")
121121
);
122122
}

0 commit comments

Comments
 (0)