Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Caudrelier committed Feb 25, 2015
1 parent dcfbd02 commit 2163cca
Show file tree
Hide file tree
Showing 5 changed files with 1,178 additions and 1 deletion.
107 changes: 107 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
*.o
*.so
*~
Makefile*
build/*
bin/*
lib/*
*.so*
*.jar
*.jardesc
.classpath
.project
.settings/*
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
/bin/
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
# extractparam
ExtractParam Burp plugin
========

# Usage
* right click in a request/response panel
* select "extract param values"

Note: highlighting the parameter will populate the field value automatically

## description
This plugin will extract all the values of the given parameter name within the Burp proxy logs.
Currently looks into:

* HTTP headers
* Requests parameters as parsed by Burp (includes GET/POST usual params, cookies, JSon)
* HTML attributes (i.e. name="[param name]" value="[param value]")
* Scripts variable assignement (i.e. param="value")

It creates a consolidated table of all uniques values and their occurences count.
It is possible to export the values list, or the URLs where those value were found or the list of Burp proxy ids for the requests/responses

It also includes some exclusions filters, such as urls in scope, response/requests only, or Content-Type based.

> Released under AGPL see LICENSE for more information
## Build requirements

* Eclipse IDE
* Burp official application jar file (to be added in the classpath)


50 changes: 50 additions & 0 deletions src/burp/BurpExtender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Released as open source by iSec Partners / NCC Group
* https://www.isecpartners.com/ - http://www.nccgroup.com/
*
* Developed by Gabriel Caudrelier, gabriel dot caudrelier at isecpartners dot com
*
* https://github.com/iSECPartners/extractparam
*
* Released under GPL see LICENSE for more information
* */

package burp;

import java.io.PrintWriter;

public class BurpExtender implements IBurpExtender {

private static IBurpExtenderCallbacks burp;
private static PrintWriter errOut;
private static PrintWriter stdOut;
private static final String VERSION = "1.0";

public BurpExtender() {

}

@Override
public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
errOut = new PrintWriter(callbacks.getStderr());
stdOut = new PrintWriter(callbacks.getStdout());

callbacks.registerContextMenuFactory(new ExtractParamContextMenu(callbacks));
callbacks.setExtensionName("Extract parameter v" + VERSION );
burp = callbacks;
}

public static final void alert(String message) {
burp.issueAlert(message);
stdOut.println(message);
}

public static final void error(String message) {
burp.issueAlert(message);
errOut.println(message);
}

public static final void message (String message) {
stdOut.println(message);
}
}
105 changes: 105 additions & 0 deletions src/burp/ExtractParamContextMenu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/**
* Released as open source by iSec Partners / NCC Group
* https://www.isecpartners.com/ - http://www.nccgroup.com/
*
* Developed by Gabriel Caudrelier, gabriel dot caudrelier at isecpartners dot com
*
* https://github.com/iSECPartners/extractparam
*
* Released under GPL see LICENSE for more information
* */

package burp;

import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.swing.AbstractAction;
import javax.swing.JMenuItem;

public class ExtractParamContextMenu implements IContextMenuFactory {

private ArrayList<JMenuItem> itemList;
private IBurpExtenderCallbacks callbacks;

public ExtractParamContextMenu(IBurpExtenderCallbacks mcallbacks) {
callbacks = mcallbacks;
itemList = new ArrayList<JMenuItem>();
}

@Override
public List<JMenuItem> createMenuItems(IContextMenuInvocation arg0) {
itemList.clear();
int tool = arg0.getToolFlag();
if (tool == IBurpExtenderCallbacks.TOOL_INTRUDER ||
tool == IBurpExtenderCallbacks.TOOL_PROXY ||
tool == IBurpExtenderCallbacks.TOOL_REPEATER ||
tool == IBurpExtenderCallbacks.TOOL_TARGET ||
tool == IBurpExtenderCallbacks.TOOL_COMPARER) {

itemList.add(new JMenuItem(new SearchParamAction(callbacks, arg0)));
return itemList;
} else {
System.out.println(" ==> Unmanaged tool " + String.valueOf(tool));
}

return null;

}

class SearchParamAction extends AbstractAction {

private static final long serialVersionUID = -6030591110872316798L;
private int[] selection;
private byte[] data;
private boolean request;
private ExtractParamDialog paramDialog;
private IContextMenuInvocation contextMenu;
private IBurpExtenderCallbacks callbacks;

public SearchParamAction(IBurpExtenderCallbacks mcallbacks, IContextMenuInvocation mContextMenu) {
super("Extract param values");
callbacks = mcallbacks;
putValue(SHORT_DESCRIPTION, "Extract all the values of the given parameter from the proxy logs");
contextMenu = mContextMenu;
}

@Override
public void actionPerformed(ActionEvent e) {
String sdata = new String();
byte contextInv = contextMenu.getInvocationContext();
request = contextInv == IContextMenuInvocation.CONTEXT_MESSAGE_EDITOR_REQUEST ||
contextInv == IContextMenuInvocation.CONTEXT_MESSAGE_VIEWER_REQUEST ||
contextInv == IContextMenuInvocation.CONTEXT_INTRUDER_PAYLOAD_POSITIONS;

IHttpRequestResponse[] messages = contextMenu.getSelectedMessages();

if (messages != null && messages.length > 0) {
if (request) {
data = messages[0].getRequest();
}
else {
data = messages[0].getResponse();
}

if (data != null) {
selection = contextMenu.getSelectionBounds();
if (selection[0] != selection[1]) {
sdata = callbacks.getHelpers().bytesToString(Arrays.copyOfRange(data,selection[0], selection[1]));
} else {
sdata = callbacks.getHelpers().bytesToString(data);
}
} else {
System.out.println("Data is null");
}
}
paramDialog = new ExtractParamDialog(callbacks, sdata);
paramDialog.setTitle("Extracting parameters/fields");
paramDialog.pack();
paramDialog.setLocationRelativeTo(null);
paramDialog.setVisible(true);
}
}
}
Loading

0 comments on commit 2163cca

Please sign in to comment.