Skip to content

Commit

Permalink
Adding duplicate current tab feature
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmoore-ncc2 committed Nov 2, 2018
1 parent d357789 commit b1ded9d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ public static String exportSave() {
}

public static String exportSave(AutoRepeater ar) {
return exportSaveAsJson(ar).toString();
}

public static JsonArray exportSaveAsJson(AutoRepeater ar) {
JsonArray BurpExtenderJson = new JsonArray();
// Don't count the "..." tab
for (int i = 0; i < mainTabbedPane.getTabCount() - 1; i++) {
Expand All @@ -133,7 +137,7 @@ public static String exportSave(AutoRepeater ar) {
BurpExtenderJson.add(AutoRepeaterJson);
}
}
return BurpExtenderJson.toString();
return BurpExtenderJson;
}

public static void initializeFromSave(String configuration, boolean replaceTabs) {
Expand All @@ -155,7 +159,7 @@ public static void initializeFromSave(String configuration, boolean replaceTabs)
}
}

private static void addNewTab(JsonObject tabContents) {
public static void addNewTab(JsonObject tabContents) {
String tabName = tabContents.get("tabName").getAsString();
tabChangeListenerLock = true;
tabCounter += 1;
Expand Down Expand Up @@ -364,7 +368,6 @@ public void mousePressed(MouseEvent e) {

public static AutoRepeater getSelectedAutoRepeater() {
AutoRepeaterTabHandle autoRepeaterTabHandle = (AutoRepeaterTabHandle) mainTabbedPane.getTabComponentAt(mainTabbedPane.getSelectedIndex());

return autoRepeaterTabHandle.autoRepeater;
}

Expand Down
21 changes: 21 additions & 0 deletions src/burp/Utils/AutoRepeaterMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import burp.Logs.LogEntry;
import burp.Logs.LogManager;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
Expand Down Expand Up @@ -184,6 +186,17 @@ public void actionPerformed(ActionEvent e) {
}
}

class DuplicateCurrentTabListener implements ActionListener {

@Override
public void actionPerformed(ActionEvent e) {
JsonArray serializedTab = BurpExtender.exportSaveAsJson(BurpExtender.getSelectedAutoRepeater());
for (JsonElement tabConfiguration : serializedTab) {
BurpExtender.addNewTab(tabConfiguration.getAsJsonObject());
}
}
}

@Override
public void extensionUnloaded() {
// unregister menu
Expand All @@ -198,21 +211,29 @@ public void run() {
JMenuBar burpJMenuBar = rootPane.getJMenuBar();
autoRepeaterJMenu = new JMenu("AutoRepeater");
// initialize menu items and add action listeners
JMenuItem duplicateCurrentTab = new JMenuItem("Duplicate Selected Tab");
duplicateCurrentTab.addActionListener(new DuplicateCurrentTabListener());

toggleSettingsVisibility = new JMenuItem("Hide Settings Panel");
toggleSettingsVisibility.addActionListener(new SettingVisibilityListener());
JCheckBoxMenuItem toggleSendRequestsToPassiveScanner = new JCheckBoxMenuItem("Send Requests To Passive Scanner");
toggleSendRequestsToPassiveScanner.addActionListener(l ->
sendRequestsToPassiveScanner = toggleSendRequestsToPassiveScanner.getState());

JCheckBoxMenuItem toggleAddRequestsToSiteMap = new JCheckBoxMenuItem("Add Requests To Site Map");
toggleAddRequestsToSiteMap.addActionListener(l ->
addRequestsToSiteMap = toggleAddRequestsToSiteMap.getState());

JMenuItem showImportMenu = new JMenuItem("Import Settings");
showImportMenu.addActionListener(new ImportSettingListener());

JMenuItem showExportMenu = new JMenuItem("Export Settings");
showExportMenu.addActionListener(new ExportSettingListener());

JMenuItem showExportLogsMenu = new JMenuItem("Export Logs");
showExportLogsMenu.addActionListener(new ExportLogsListener());
// add menu items to the menu
autoRepeaterJMenu.add(duplicateCurrentTab);
autoRepeaterJMenu.add(toggleSettingsVisibility);
autoRepeaterJMenu.addSeparator();
autoRepeaterJMenu.add(toggleAddRequestsToSiteMap);
Expand Down

0 comments on commit b1ded9d

Please sign in to comment.