-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
SPuttkammer
committed
Aug 10, 2019
1 parent
83d8d9d
commit 23eb279
Showing
110 changed files
with
5,562 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
target/ | ||
pom.xml.tag | ||
pom.xml.releaseBackup | ||
pom.xml.versionsBackup | ||
pom.xml.next | ||
release.properties | ||
dependency-reduced-pom.xml | ||
buildNumber.properties | ||
.mvn/timing.properties | ||
.mvn/wrapper/maven-wrapper.jar | ||
.classpath | ||
.project | ||
.settings/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>de.usd.CSTC</groupId> | ||
<artifactId>CSTC</artifactId> | ||
<version>0.1.1</version> | ||
<name>CSTC</name> | ||
<description>CSTC</description> | ||
<build> | ||
<sourceDirectory>src</sourceDirectory> | ||
<resources> | ||
<resource> | ||
<directory>src</directory> | ||
<excludes> | ||
<exclude>**/*.java</exclude> | ||
</excludes> | ||
</resource> | ||
<resource> | ||
<directory>res</directory> | ||
<excludes> | ||
<exclude>**/*.java</exclude> | ||
</excludes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.7.0</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.jayway.jsonpath</groupId> | ||
<artifactId>json-path</artifactId> | ||
<version>2.4.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.portswigger.burp.extender</groupId> | ||
<artifactId>burp-extender-api</artifactId> | ||
<version>1.7.22</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.bouncycastle</groupId> | ||
<artifactId>bcprov-jdk15on</artifactId> | ||
<version>1.59</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core --> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
<version>2.9.8</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind --> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.9.8</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
package burp; | ||
|
||
import java.awt.Component; | ||
import java.awt.Container; | ||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import javax.swing.JMenuItem; | ||
import javax.swing.JTextArea; | ||
import javax.swing.JTextField; | ||
import javax.swing.plaf.basic.BasicTabbedPaneUI; | ||
import javax.swing.text.JTextComponent; | ||
|
||
import de.usd.cstchef.view.FormatTab; | ||
import de.usd.cstchef.view.RecipePanel; | ||
import de.usd.cstchef.view.View; | ||
|
||
public class BurpExtender implements IBurpExtender, ITab, IMessageEditorTabFactory, IHttpListener, IContextMenuFactory { | ||
|
||
private final String extensionName = "CSTC"; | ||
private IBurpExtenderCallbacks callbacks; | ||
private View view; | ||
|
||
@Override | ||
public void registerExtenderCallbacks(final IBurpExtenderCallbacks callbacks) { | ||
this.callbacks = callbacks; | ||
Logger.getInstance().init(callbacks.getStdout(), callbacks.getStderr()); | ||
BurpUtils.getInstance().init(callbacks); | ||
|
||
callbacks.setExtensionName(this.extensionName); | ||
callbacks.addSuiteTab(this); | ||
callbacks.registerHttpListener(this); | ||
callbacks.registerContextMenuFactory(this); | ||
callbacks.registerMessageEditorTabFactory(this); | ||
} | ||
|
||
|
||
@Override | ||
public String getTabCaption() { | ||
return this.extensionName; | ||
} | ||
|
||
@Override | ||
public Component getUiComponent() { | ||
this.view = new View(); | ||
return this.view; | ||
} | ||
|
||
@Override | ||
public void processHttpMessage(int toolFlag, boolean messageIsRequest, IHttpRequestResponse messageInfo) { | ||
if (messageIsRequest && view.getOutgoingRecipePanel().shouldProcess(toolFlag)) { | ||
byte[] request = messageInfo.getRequest(); | ||
byte[] modifiedRequest = view.getOutgoingRecipePanel().bake(request); | ||
Logger.getInstance().log("modified request: \n" + new String(modifiedRequest)); | ||
messageInfo.setRequest(modifiedRequest); | ||
} else if (view.getIncomingRecipePanel().shouldProcess(toolFlag)) { | ||
byte[] response = messageInfo.getResponse(); | ||
byte[] modifiedResponse = view.getIncomingRecipePanel().bake(response); | ||
messageInfo.setResponse(modifiedResponse); | ||
Logger.getInstance().log("modified response: \n" + new String(modifiedResponse)); | ||
} | ||
} | ||
|
||
@Override | ||
public List<JMenuItem> createMenuItems(IContextMenuInvocation invoc) { | ||
|
||
List<JMenuItem> menuItems = new ArrayList<>(); | ||
JMenuItem incomingMenu = new JMenuItem("Send to CSTC (Incoming)"); | ||
JMenuItem outgoingMenu = new JMenuItem("Send to CSTC (Outgoing)"); | ||
JMenuItem incomingFormatMenu = new JMenuItem("Send to CSTC (Formating)"); | ||
|
||
menuItems.add(incomingMenu); | ||
menuItems.add(outgoingMenu); | ||
menuItems.add(incomingFormatMenu); | ||
|
||
incomingMenu.addActionListener(new ActionListener() { | ||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
IHttpRequestResponse[] msgs = invoc.getSelectedMessages(); | ||
if (msgs != null && msgs.length > 0) { | ||
view.getIncomingRecipePanel().setInput(new String(msgs[0].getResponse())); | ||
} | ||
} | ||
}); | ||
|
||
outgoingMenu.addActionListener(new ActionListener() { | ||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
IHttpRequestResponse[] msgs = invoc.getSelectedMessages(); | ||
if (msgs != null && msgs.length > 0) { | ||
view.getOutgoingRecipePanel().setInput(new String(msgs[0].getRequest())); | ||
} | ||
|
||
} | ||
}); | ||
|
||
incomingFormatMenu.addActionListener(new ActionListener() { | ||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
IHttpRequestResponse[] msgs = invoc.getSelectedMessages(); | ||
if (msgs != null && msgs.length > 0) { | ||
view.getFormatRecipePanel().setInput(new String(msgs[0].getRequest())); | ||
} | ||
} | ||
}); | ||
|
||
return menuItems; | ||
} | ||
|
||
@Override | ||
public IMessageEditorTab createNewInstance(IMessageEditorController controller, boolean editable) { | ||
RecipePanel requestFormatPanel = this.view.getOutgoingRecipePanel(); | ||
// TODO do we need the format panel or do we want to use the incoming recipe? | ||
RecipePanel responseFormatPanel = this.view.getFormatRecipePanel(); | ||
return new FormatTab(requestFormatPanel, responseFormatPanel, editable); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package burp; | ||
|
||
public class BurpUtils { | ||
|
||
private static BurpUtils instance; | ||
private IBurpExtenderCallbacks callbacks; | ||
|
||
public static BurpUtils getInstance() { | ||
if (BurpUtils.instance == null) { | ||
BurpUtils.instance = new BurpUtils(); | ||
} | ||
return BurpUtils.instance; | ||
} | ||
|
||
private BurpUtils() { | ||
} | ||
|
||
public void init(IBurpExtenderCallbacks callbacks) { | ||
this.callbacks = callbacks; | ||
} | ||
|
||
public IBurpExtenderCallbacks getCallbacks() throws IllegalAccessError { | ||
if (this.callbacks == null) { | ||
throw new IllegalAccessError("Only works within burpsuite"); | ||
} | ||
return callbacks; | ||
} | ||
|
||
public static boolean inBurp() { | ||
try { | ||
BurpUtils.getInstance().getCallbacks(); | ||
return true; | ||
} catch (IllegalAccessError e) { | ||
return false; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package burp; | ||
|
||
import java.io.OutputStream; | ||
import java.io.PrintWriter; | ||
|
||
public class Logger { | ||
|
||
private static Logger instance; | ||
|
||
private PrintWriter stdout; | ||
private PrintWriter stderr; | ||
|
||
public static Logger getInstance() { | ||
if (Logger.instance == null) { | ||
Logger.instance = new Logger(); | ||
} | ||
return Logger.instance; | ||
} | ||
|
||
private Logger() { | ||
|
||
} | ||
|
||
public void init(OutputStream stdOut, OutputStream stdErr) { | ||
this.stdout = new PrintWriter(stdOut, true); | ||
this.stderr = new PrintWriter(stdErr, true); | ||
} | ||
|
||
public void log(String msg) { | ||
if (this.stdout == null) { | ||
System.out.println(msg); | ||
} else { | ||
this.stdout.println(msg); | ||
} | ||
} | ||
|
||
public void err(String msg) { | ||
if (this.stderr == null) { | ||
System.err.println(msg); | ||
} else { | ||
this.stderr.println(msg); | ||
} | ||
} | ||
} |
Oops, something went wrong.