Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from FrUh/master
Browse files Browse the repository at this point in the history
new version ExtendedMacro 0.0.5
  • Loading branch information
ahri authored Apr 30, 2017
2 parents 3d1416e + 7cf7127 commit fc1c365
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 25 deletions.
2 changes: 1 addition & 1 deletion BappManifest.bmf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Uuid: 33839d04fdaa4e3b80292fbed115db13
ExtensionType: 1
Name: ExtendedMacro
RepoName: extended-macro
ScreenVersion: 0.0.3
ScreenVersion: 0.0.5
SerialVersion: 1
MinPlatformVersion: 0
ProOnly: False
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ It is still in development, so please don't be angry if something getting wrong,
- create sequence of the request to be triggered before the every request call
- extract data from arbitrary response
- paste extracted data into arbitrary following request
- from the sequence
- into the last request (Intruder, Repeater, Scanner, Sequencer or Spider)
- replacement of the existing data
- add new HTTP header
- replacement of the HTTP header
- create new header
- changing order of the requests
- URL decoding of extracted data
- extracted data caching
- you can specify time interval, when the extraction will be performed

## Advantages against the BurpSuite Macro
- ability to replace arbitrary string in the request
- ability to add new header into the request
- easier configuration than macro (does not seems to be, but it is ;))
- extracted data caching

## About the UI
The plug-in adds new tab into the BurpSuite named "ExtendedMacro". It contains several tabs: "Main", "Logger" and "Settings".
Expand Down
Binary file modified screenshot/logger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshot/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshot/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 40 additions & 16 deletions src/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
public class BurpExtender implements IBurpExtender, IHttpListener, IContextMenuFactory, ITab {
private static String EXTENSION_NAME = "ExtendedMacro";
private static String EXTENSION_NAME_TAB_NAME = "Extended Macro";
private static String VERSION = "0.0.3";
private static String VERSION = "0.0.5";
public PrintWriter stdout;
public PrintWriter stderr;
public IExtensionHelpers helpers;
private IBurpExtenderCallbacks callbacks;
private MessagesTable extMessagesTable;
private MessagesTable repMessagesTable;
private JPanel mainPanel;
private JSplitPane mainPanel;
private MessagesModel messagesModel;
private IMessageEditor extRequestEditor;
private IMessageEditor extResponseEditor;
Expand Down Expand Up @@ -113,8 +113,26 @@ public String getNextMsgIdLogger() {
private void initGui() {
mainTabPane = new JTabbedPane();

mainPanel = new JPanel();
mainPanel.setLayout(new GridLayout(3, 2));
JSplitPane mainPanel_up = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

JPanel p1 = new JPanel();
JPanel p2 = new JPanel();
JPanel p3 = new JPanel();

p1.setLayout(new GridLayout(1, 2));
p2.setLayout(new GridLayout(1, 2));
p3.setLayout(new GridLayout(1, 2));

mainPanel_up.add(p1);
mainPanel_up.add(p2);
mainPanel.add(mainPanel_up);
mainPanel.add(p3);
mainPanel.setResizeWeight(0.25);

p1.setPreferredSize(new Dimension(100, 200));
p2.setPreferredSize(new Dimension(100, 500));
p3.setPreferredSize(new Dimension(100, 80));

messagesModel = new MessagesModel(this.helpers);

Expand Down Expand Up @@ -161,7 +179,7 @@ private void initGui() {
JTabbedPane extMessagesTab = new JTabbedPane();
extMessagesTab.addTab("Extraction message list", extMsgScrollPane);

mainPanel.add(extMessagesTab);
p1.add(extMessagesTab);

// replace messages table
repMessagesTable = new MessagesTable(this, false);
Expand Down Expand Up @@ -202,11 +220,11 @@ private void initGui() {
JTabbedPane repMessagesTab = new JTabbedPane();
repMessagesTab.addTab("Replace message list", repMsgScrollPane);

mainPanel.add(repMessagesTab);
p1.add(repMessagesTab);

// add editor tabs
mainPanel.add(extMessagesTabs);
mainPanel.add(repMessagesTabs);
p2.add(extMessagesTabs);
p2.add(repMessagesTabs);

// extraction panel
JPanel extractionPanel = new JPanel();
Expand Down Expand Up @@ -266,7 +284,7 @@ private void initGui() {
extButtonsPane.add(extFromSelectionButton);

extractionPanel.add(extButtonsPane);
mainPanel.add(extTab);
p3.add(extTab);

// replace panel
JPanel replacePanel = new JPanel();
Expand Down Expand Up @@ -296,9 +314,9 @@ private void initGui() {
replaceType = new JComboBox<>();
replaceType.addItem(Replace.TYPE_REP_SEL);
replaceType.addItem(Replace.TYPE_ADD_SEL);
replaceType.addItem(Replace.TYPE_REP_LAST);
replaceType.addItem(Replace.TYPE_ADD_LAST);
replaceType.addItem(Replace.TYPE_REP_HEADER_LAST);
replaceType.addItem(Replace.TYPE_REP_BURP);
replaceType.addItem(Replace.TYPE_ADD_BURP);
replaceType.addItem(Replace.TYPE_REP_HEADER_BURP);
replaceNameStringField = new JTextField();

replaceType.addActionListener(new ConfigChangedListener(this, ConfigActions.A_REP_CONFIG_CHANGED));
Expand Down Expand Up @@ -331,7 +349,7 @@ private void initGui() {
replaceButtonsPane.add(repFromSelectionButton);

replacePanel.add(replaceButtonsPane);
mainPanel.add(repTab);
p3.add(repTab);

mainTabPane.addTab("Main window", mainPanel);

Expand Down Expand Up @@ -383,7 +401,13 @@ private void initGui() {
logger.add(loggerMessagesEditorPanel);

mainTabPane.addTab("Logger", logger);
p1.revalidate();
p2.revalidate();
p3.revalidate();

p1.repaint();
p2.repaint();
p3.repaint();
initSettingsGui(mainTabPane);
}

Expand Down Expand Up @@ -754,9 +778,9 @@ public boolean isValidReplace() {


String replaceTypeString = replaceType.getSelectedItem().toString();
if (replaceTypeString.equals(Replace.TYPE_ADD_LAST) ||
replaceTypeString.equals(Replace.TYPE_REP_LAST) ||
replaceTypeString.equals(Replace.TYPE_REP_HEADER_LAST)) {
if (replaceTypeString.equals(Replace.TYPE_ADD_BURP) ||
replaceTypeString.equals(Replace.TYPE_REP_BURP) ||
replaceTypeString.equals(Replace.TYPE_REP_HEADER_BURP)) {
ignore_rep_row = true;
}

Expand Down
1 change: 1 addition & 0 deletions src/burp/ConfigListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public void actionPerformed(ActionEvent actionEvent) {
extender.getReplaceModel().addReplace(rep);
}
else {
rep.setMsgId("Burp");
extender.getReplaceModel().addReplaceLast(rep);
}
extender.stdout.println("[+] Adding new replace: " + rep);
Expand Down
11 changes: 5 additions & 6 deletions src/burp/Replace.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

import java.util.List;
import java.util.Iterator;
import java.io.PrintWriter;

/**
* Created by fruh on 9/7/16.
*/
public class Replace {
public static String TYPE_REP_SEL = "Replace on selected";
public static String TYPE_ADD_SEL = "Add new header on selected";
public static String TYPE_REP_LAST = "Replace on last request";
public static String TYPE_ADD_LAST = "Add new header on last request";
public static String TYPE_REP_HEADER_LAST = "Replace header on last request";
public static String TYPE_REP_BURP = "Replace on Burp request";
public static String TYPE_ADD_BURP = "Add new header on Burp request";
public static String TYPE_REP_HEADER_BURP = "Replace header on Burp request";

private boolean urlDecode = false;
private String dataToPaste;
Expand Down Expand Up @@ -46,13 +45,13 @@ public void setReplaceStr(String replaceStr) {
}

public String replaceData(String request, IExtensionHelpers helpers) {
if (type.equals(TYPE_REP_SEL) || type.equals(TYPE_REP_LAST)) {
if (type.equals(TYPE_REP_SEL) || type.equals(TYPE_REP_BURP)) {
request = request.replace(replaceStr, dataToPaste);
} else {
IRequestInfo rqInfo = helpers.analyzeRequest(request.getBytes());
List<String> headers = rqInfo.getHeaders();

if (type.equals(TYPE_REP_HEADER_LAST)){
if (type.equals(TYPE_REP_HEADER_BURP)){
for (Iterator<String> iterator = headers.iterator(); iterator.hasNext();){
String header = iterator.next();
if (header.startsWith(replaceStr)){
Expand Down

0 comments on commit fc1c365

Please sign in to comment.