Skip to content

Commit

Permalink
Merge pull request #151 from usdAG/develop
Browse files Browse the repository at this point in the history
Release v1.3.2
  • Loading branch information
fhaag95 authored Jul 19, 2024
2 parents 4e58acb + f985e3d commit fa9b802
Show file tree
Hide file tree
Showing 28 changed files with 350 additions and 133 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [1.3.2] - 2024-07-16

### Added

* Add operation JSON Beautifier
* Add Sequencer filter option
* Add GZIP operation option to set the compression level
* Add comment function to operations and recipe lanes
* Add editable lane names

### Changed

* Fix the emergence of null bytes when using variables
* Fix GUI issues with using the operation Drag-and-Drop
* Change the saved recipe structure and add CSTC version, operation comments, lane comments and lane names
* Refactor operation button icons


## [1.3.1] - 2024-05-22

### Added
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ Take a look at our basic tutorial on [YouTube](https://www.youtube.com/watch?v=B
**UPDATE:** Due to some incompatibility issues when installing *CSTC* via *BApp Store*, we had to switch to a new variable prefix.
Variables from other *lanes* have now to be prefixed by ``$`` e.g. like ``$Outgoing_step1``.

## FAQ

### How does the CSTC interact with other Extensions?

Requests and responses pass through the extensions in the order that they are listed, from top to bottom (as described [here](https://portswigger.net/burp/documentation/desktop/extensions/managing-extensions)).
Depending on the extensions in use, it may make sense to adjust the position of the CSTC. If you want to process a request manipulated by the CSTC in another extension,
the CSTC should be positioned above this extension. Conversely, the CSTC should be positioned below an extension if the CSTC is to work with the response processed by the extension in question.
Currently the Burp Montoya API doesn't offer a way to change this order automatically, therefore the CSTC cannot influence the interaction with other extensions itself.

## Feedback

We gladly appreciate all feedback, bug reports and feature requests.
Expand Down
Binary file modified media/CSTC_Workflow.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.usd.CSTC</groupId>
<artifactId>CSTC</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
<name>CSTC</name>
<description>CSTC</description>

Expand Down Expand Up @@ -35,13 +35,13 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.17.1</version>
<version>2.17.2</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.1</version>
<version>2.17.2</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -85,6 +85,7 @@

<resource>
<directory>res</directory>
<filtering>true</filtering>
</resource>

</resources>
Expand All @@ -102,7 +103,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<version>3.3.1</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
Expand Down
Binary file added res/comment.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 res/disable.png
100644 → 100755
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 res/help.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/no_comment.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 res/operation.png
100644 → 100755
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 res/remove.png
100644 → 100755
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 res/stop.png
100644 → 100755
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 res/stop_active.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions res/version.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = ${project.version}
1 change: 0 additions & 1 deletion src/main/java/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public void initialize(MontoyaApi api) {
api.http().registerHttpHandler(new CstcHttpHandler(view));
api.userInterface().registerSuiteTab(extensionName, view);
api.userInterface().registerHttpRequestEditorProvider(new MyHttpRequestEditorProvider(view));
api.userInterface().registerHttpResponseEditorProvider(new MyHttpResponseEditorProvider(view));

if (!api.burpSuite().version().edition().equals(BurpSuiteEdition.COMMUNITY_EDITION)) {
PersistedObject persistence = api.persistence().extensionData();
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/burp/CstcHttpHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public RequestToBeSentAction handleHttpRequestToBeSent(HttpRequestToBeSent reque
if (BurpUtils.getInstance().getFilterState().shouldProcess(FilterState.BurpOperation.OUTGOING, requestToBeSent.toolSource())) {
ByteArray request = requestToBeSent.toByteArray();
ByteArray modifiedRequest = view.getOutgoingRecipePanel().bake(request, MessageType.REQUEST);
Logger.getInstance().log("modified request: \n" + new String(modifiedRequest.getBytes()));
return continueWith(HttpRequest.httpRequest(modifiedRequest).withService(requestToBeSent.httpService()));
}
else{
Expand All @@ -41,7 +40,6 @@ public ResponseReceivedAction handleHttpResponseReceived(HttpResponseReceived re
if (BurpUtils.getInstance().getFilterState().shouldProcess(FilterState.BurpOperation.INCOMING, responseReceived.toolSource())) {
ByteArray response = responseReceived.toByteArray();
ByteArray modifiedResponse = view.getIncomingRecipePanel().bake(response, MessageType.RESPONSE);
Logger.getInstance().log("modified response: \n" + new String(modifiedResponse.getBytes()));
return continueWith(HttpResponse.httpResponse(modifiedResponse));
}
else{
Expand Down
15 changes: 12 additions & 3 deletions src/main/java/burp/MyExtensionProvidedHttpRequestEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import burp.api.montoya.MontoyaApi;
import burp.api.montoya.core.ByteArray;
import burp.api.montoya.core.ToolType;
import burp.api.montoya.http.message.HttpRequestResponse;
import burp.api.montoya.http.message.requests.HttpRequest;
import burp.api.montoya.repeater.Repeater;
import burp.api.montoya.ui.Selection;
import burp.api.montoya.ui.editor.EditorOptions;
import burp.api.montoya.ui.editor.RawEditor;
Expand All @@ -23,9 +25,16 @@ public class MyExtensionProvidedHttpRequestEditor implements ExtensionProvidedHt

MyExtensionProvidedHttpRequestEditor(EditorCreationContext creationContext, View view)
{
this.api = BurpUtils.getInstance().getApi();
this.view = view;
requestEditor = api.userInterface().createRawEditor(EditorOptions.READ_ONLY);
if(creationContext.toolSource().isFromTool(ToolType.REPEATER)) {
this.api = BurpUtils.getInstance().getApi();
this.view = view;
requestEditor = api.userInterface().createRawEditor(EditorOptions.READ_ONLY);
}
else {
this.api = null;
this.view = null;
this.requestEditor = null;
}
}

@Override
Expand Down
73 changes: 0 additions & 73 deletions src/main/java/burp/MyExtensionProvidedHttpResponseEditor.java

This file was deleted.

23 changes: 0 additions & 23 deletions src/main/java/burp/MyHttpResponseEditorProvider.java

This file was deleted.

10 changes: 7 additions & 3 deletions src/main/java/de/usd/cstchef/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import de.usd.cstchef.operations.conditional.StringContains;
import de.usd.cstchef.operations.conditional.StringMatch;
import de.usd.cstchef.operations.dataformat.FromBase64;
import de.usd.cstchef.operations.dataformat.JsonBeautifier;
import de.usd.cstchef.operations.dataformat.FromHex;
import de.usd.cstchef.operations.dataformat.HtmlDecode;
import de.usd.cstchef.operations.dataformat.HtmlEncode;
Expand Down Expand Up @@ -217,8 +218,11 @@ public static HttpRequest addCookieToHttpRequest(HttpRequest request, Cookie coo
}

public static ByteArray insertAtOffset(ByteArray input, int start, int end, ByteArray newValue) {
ByteArray prefix = BurpUtils.subArray(input, 0, start);
ByteArray rest = BurpUtils.subArray(input, end, input.length());
ByteArray prefix = input.subArray(0, start);
ByteArray rest = input.subArray(0, 0);
if(end < input.length()) {
rest = input.subArray(end, input.length());
}

ByteArray output = prefix.withAppended(newValue).withAppended(rest);
return output;
Expand Down Expand Up @@ -318,7 +322,7 @@ public static Class<? extends Operation>[] getOperationsDev() {
TimestampOffset.class, TimestampToDateTime.class, ToBase64.class, ToHex.class, UnixTimestamp.class,
UrlDecode.class, UrlEncode.class,
Whirlpool.class, WriteFile.class, XmlFullSignature.class, XmlMultiSignature.class,
Xor.class, SoapMultiSignature.class, Luhn.class, Concatenate.class
Xor.class, SoapMultiSignature.class, Luhn.class, Concatenate.class, JsonBeautifier.class
};
}

Expand Down
36 changes: 36 additions & 0 deletions src/main/java/de/usd/cstchef/operations/Operation.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.EOFException;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand All @@ -19,6 +21,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
Expand All @@ -28,6 +31,7 @@
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JSpinner;
Expand Down Expand Up @@ -68,6 +72,8 @@ public abstract class Operation extends JPanel {
private static ImageIcon disableIcon = new ImageIcon(Operation.class.getResource("/disable.png"));
private static ImageIcon removeIcon = new ImageIcon(Operation.class.getResource("/remove.png"));
private static ImageIcon helpIcon = new ImageIcon(Operation.class.getResource("/help.png"));
private static ImageIcon commentIcon = new ImageIcon(Operation.class.getResource("/comment.png"));
private static ImageIcon noCommentIcon = new ImageIcon(Operation.class.getResource("/no_comment.png"));

private NotifyChangeListener notifyChangeListener;

Expand All @@ -80,6 +86,9 @@ public abstract class Operation extends JPanel {
private Box contentBox;
private Map<String, Component> uiElements;

private String comment;
private JButton commentBtn;

private int operationSkip = 0;
private int laneSkip = 0;

Expand Down Expand Up @@ -122,6 +131,19 @@ public Operation() {
removeBtn.setToolTipText("Remove");
JButton helpBtn = createIconButton(Operation.helpIcon);
helpBtn.setToolTipText(opInfos.description());
commentBtn = createIconButton(noCommentIcon);

commentBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
commentBtn.setToolTipText(getComment());
String comment = JOptionPane.showInputDialog("Edit comment:", commentBtn.getToolTipText());
commentBtn.setToolTipText(comment);
setComment(comment);
ImageIcon newIcon = comment.isEmpty() ? Operation.noCommentIcon : Operation.commentIcon;
commentBtn.setIcon(newIcon);
}
});


disableBtn.addActionListener(new ActionListener() {
@Override
Expand Down Expand Up @@ -162,6 +184,8 @@ public void actionPerformed(ActionEvent e) {
header.add(titleLbl);
header.add(Box.createHorizontalStrut(6));
header.add(helpBtn);
header.add(Box.createHorizontalStrut(3));
header.add(commentBtn);
header.add(Box.createHorizontalGlue());
header.add(disableBtn);
header.add(Box.createHorizontalStrut(3));
Expand Down Expand Up @@ -189,6 +213,18 @@ public void actionPerformed(ActionEvent e) {
this.refreshColors();
}

public String getComment() {
return this.comment;
}

public void setComment(String comment) {
if(comment != null) {
this.comment = comment;
commentBtn.setIcon(Operation.commentIcon);
commentBtn.setToolTipText(comment);
}
}

public Map<String, Object> getState() {
Map<String, Object> properties = new HashMap<>();
for (String key : this.uiElements.keySet()) {
Expand Down
Loading

0 comments on commit fa9b802

Please sign in to comment.