Skip to content

Commit

Permalink
Merge branch 'feat/conferences-changes' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
fhaag95 committed Aug 19, 2024
2 parents 3acc716 + 57746cd commit fb37843
Show file tree
Hide file tree
Showing 29 changed files with 288 additions and 34 deletions.
4 changes: 3 additions & 1 deletion src/main/java/de/usd/cstchef/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@
import de.usd.cstchef.operations.string.Reverse;
import de.usd.cstchef.operations.string.SplitAndSelect;
import de.usd.cstchef.operations.string.StaticString;
import de.usd.cstchef.operations.string.Strip;
import de.usd.cstchef.operations.string.RemoveWhitespace;
import de.usd.cstchef.operations.string.Substring;
import de.usd.cstchef.operations.string.Suffix;
import de.usd.cstchef.operations.string.Uppercase;
Expand Down Expand Up @@ -319,7 +321,7 @@ public static Class<? extends Operation>[] getOperationsDevOutgoingFormatting()
SetIfEmpty.class, SHA1.class, SHA2.class, SHA3.class, Skein.class, SplitAndSelect.class,
StaticString.class, StoreVariable.class, Sub.class, Substring.class, Uppercase.class, Lowercase.class,
Subtraction.class,
Suffix.class, Sum.class, StringContains.class, StringMatch.class, Tiger.class,
Suffix.class, Sum.class, StringContains.class, StringMatch.class, Strip.class, RemoveWhitespace.class, Tiger.class,
TimestampOffset.class, TimestampToDateTime.class, ToBase64.class, ToHex.class, UnixTimestamp.class,
UrlDecode.class, UrlEncode.class,
Whirlpool.class, WriteFile.class, XmlFullSignature.class, XmlMultiSignature.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.operations.Operation.OperationInfos;

@OperationInfos(name = "HTTP Body", category = OperationCategory.EXTRACTORS, description = "Extracts the body of a HTTP messages.")
@OperationInfos(name = "Get HTTP Body", category = OperationCategory.EXTRACTORS, description = "Extracts the body of a HTTP messages.")
public class HttpBodyExtractor extends Operation {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.view.ui.VariableTextField;

@OperationInfos(name = "HTTP Cookie", category = OperationCategory.EXTRACTORS, description = "Extracts a cookie from a HTTP message.")
@OperationInfos(name = "Get HTTP Cookie", category = OperationCategory.EXTRACTORS, description = "Extracts a cookie from a HTTP message.")
public class HttpCookieExtractor extends Operation {

protected VariableTextField cookieNameField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.view.ui.VariableTextField;

@OperationInfos(name = "HTTP GET Param", category = OperationCategory.EXTRACTORS, description = "Extracts a GET Parameter of a HTTP request.")
@OperationInfos(name = "Get HTTP GET Param", category = OperationCategory.EXTRACTORS, description = "Extracts a GET Parameter of a HTTP request.")
public class HttpGetExtractor extends Operation {

protected VariableTextField parameter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.view.ui.VariableTextField;

@OperationInfos(name = "HTTP Header", category = OperationCategory.EXTRACTORS, description = "Extracts a header of a HTTP message.")
@OperationInfos(name = "Get HTTP Header", category = OperationCategory.EXTRACTORS, description = "Extracts a header of a HTTP message.")
public class HttpHeaderExtractor extends Operation {

protected VariableTextField headerNameField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import de.usd.cstchef.operations.Operation.OperationInfos;
import de.usd.cstchef.operations.OperationCategory;

@OperationInfos(name = "HTTP JSON", category = OperationCategory.EXTRACTORS, description = "Get a JSON value from HTTP message.")
@OperationInfos(name = "Get HTTP JSON", category = OperationCategory.EXTRACTORS, description = "Get a JSON value from HTTP message.")
public class HttpJsonExtractor extends Operation {

protected JTextField fieldTxt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import de.usd.cstchef.operations.Operation.OperationInfos;
import de.usd.cstchef.operations.OperationCategory;

@OperationInfos(name = "HTTP Method", category = OperationCategory.EXTRACTORS, description = "Extracts the method of a HTTP request.")
@OperationInfos(name = "Get HTTP Method", category = OperationCategory.EXTRACTORS, description = "Extracts the method of a HTTP request.")
public class HttpMethodExtractor extends Operation {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.view.ui.VariableTextField;

@OperationInfos(name = "HTTP Multipart Param", category = OperationCategory.EXTRACTORS, description = "Extracts a part of a multipart/form-data request.")
@OperationInfos(name = "Get HTTP Multipart Param", category = OperationCategory.EXTRACTORS, description = "Extracts a part of a multipart/form-data request.")
public class HttpMultipartExtractor extends Operation {

protected VariableTextField parameter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.view.ui.VariableTextField;

@OperationInfos(name = "HTTP POST Param", category = OperationCategory.EXTRACTORS, description = "Extracts a POST parameter of a HTTP request.")
@OperationInfos(name = "Get HTTP POST Param", category = OperationCategory.EXTRACTORS, description = "Extracts a POST parameter of a HTTP request.")
public class HttpPostExtractor extends Operation {

protected VariableTextField parameter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import de.usd.cstchef.operations.Operation.OperationInfos;
import de.usd.cstchef.operations.OperationCategory;

@OperationInfos(name = "HTTP URI", category = OperationCategory.EXTRACTORS, description = "Extracts the URI of a HTTP request.")
@OperationInfos(name = "Get HTTP URI", category = OperationCategory.EXTRACTORS, description = "Extracts the URI of a HTTP request.")
public class HttpUriExtractor extends Operation {

protected JCheckBox checkbox;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import de.usd.cstchef.operations.Operation.OperationInfos;
import de.usd.cstchef.operations.OperationCategory;

@OperationInfos(name = "HTTP XML", category = OperationCategory.EXTRACTORS, description = "Extract the first occurrence of a XML value from HTTP message.")
@OperationInfos(name = "Get HTTP XML", category = OperationCategory.EXTRACTORS, description = "Extract the first occurrence of a XML value from HTTP message.")
public class HttpXmlExtractor extends Operation {

protected JTextField fieldTxt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import de.usd.cstchef.operations.Operation.OperationInfos;
import de.usd.cstchef.operations.OperationCategory;

@OperationInfos(name = "JSON", category = OperationCategory.EXTRACTORS, description = "Extracts values of JSON objects.")
@OperationInfos(name = "Get JSON", category = OperationCategory.EXTRACTORS, description = "Extracts values of JSON objects.")
public class JsonExtractor extends Operation {

private static JsonProvider provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import de.usd.cstchef.operations.Operation.OperationInfos;
import de.usd.cstchef.operations.OperationCategory;

@OperationInfos(name = "HTTP GET Param", category = OperationCategory.SETTER, description = "Sets a GET parameter to the specified value.")
@OperationInfos(name = "Set HTTP GET Param", category = OperationCategory.SETTER, description = "Sets a GET parameter to the specified value.")
public class HttpGetSetter extends SetterOperation {

private JCheckBox addIfNotPresent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.operations.extractors.JsonExtractor;

@OperationInfos(name = "HTTP Header", category = OperationCategory.SETTER, description = "Set a HTTP header to the specified value.")
@OperationInfos(name = "Set HTTP Header", category = OperationCategory.SETTER, description = "Set a HTTP header to the specified value.")
public class HttpHeaderSetter extends SetterOperation {

private JCheckBox addIfNotPresent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import de.usd.cstchef.operations.extractors.JsonExtractor;
import de.usd.cstchef.view.ui.VariableTextField;

@OperationInfos(name = "HTTP JSON", category = OperationCategory.SETTER, description = "Set a JSON parameter to the specified value.")
@OperationInfos(name = "Set HTTP JSON", category = OperationCategory.SETTER, description = "Set a JSON parameter to the specified value.")
public class HttpJsonSetter extends SetterOperation {

private JCheckBox addIfNotPresent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import de.usd.cstchef.operations.Operation.OperationInfos;
import de.usd.cstchef.operations.OperationCategory;

@OperationInfos(name = "HTTP Multipart Param", category = OperationCategory.SETTER, description = "Sets a part of a multipart/form-data request to the specified value.")
@OperationInfos(name = "Set HTTP Multipart Param", category = OperationCategory.SETTER, description = "Sets a part of a multipart/form-data request to the specified value.")
public class HttpMultipartSetter extends SetterOperation {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import de.usd.cstchef.operations.Operation.OperationInfos;
import de.usd.cstchef.operations.OperationCategory;

@OperationInfos(name = "HTTP POST Param", category = OperationCategory.SETTER, description = "Set a POST parameter to the specified value.")
@OperationInfos(name = "Set HTTP POST Param", category = OperationCategory.SETTER, description = "Set a POST parameter to the specified value.")
public class HttpPostSetter extends SetterOperation {

private JCheckBox addIfNotPresent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import de.usd.cstchef.operations.Operation.OperationInfos;
import de.usd.cstchef.view.ui.FormatTextField;

@OperationInfos(name = "HTTP Body", category = OperationCategory.SETTER, description = "Set the HTTP body to the specified value.")
@OperationInfos(name = "Set HTTP Body", category = OperationCategory.SETTER, description = "Set the HTTP body to the specified value.")
public class HttpSetBody extends Operation {

private FormatTextField replacementTxt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import de.usd.cstchef.operations.Operation.OperationInfos;
import de.usd.cstchef.operations.OperationCategory;

@OperationInfos(name = "HTTP Cookie", category = OperationCategory.SETTER, description = "Set a HTTP cookie to the specified value.")
@OperationInfos(name = "Set HTTP Cookie", category = OperationCategory.SETTER, description = "Set a HTTP cookie to the specified value.")
public class HttpSetCookie extends SetterOperation {

private JCheckBox addIfNotPresent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.view.ui.VariableTextField;

@OperationInfos(name = "HTTP URI", category = OperationCategory.SETTER, description = "Sets the specified variable as the uri.")
@OperationInfos(name = "Set HTTP URI", category = OperationCategory.SETTER, description = "Sets the specified variable as the uri.")
public class HttpSetUri extends Operation {

private VariableTextField uriTxt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.view.ui.VariableTextField;

@OperationInfos(name = "HTTP XML", category = OperationCategory.SETTER, description = "Set a XML parameter to the specified value.")
@OperationInfos(name = "Set HTTP XML", category = OperationCategory.SETTER, description = "Set a XML parameter to the specified value.")
public class HttpXmlSetter extends SetterOperation {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.view.ui.VariableTextField;

@OperationInfos(name = "JSON", category = OperationCategory.SETTER, description = "Set the value of a JSON object.")
@OperationInfos(name = "Set JSON", category = OperationCategory.SETTER, description = "Set the value of a JSON object.")
public class JsonSetter extends SetterOperation implements ActionListener {

private JCheckBox addIfNotPresent;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package de.usd.cstchef.operations.string;

import javax.swing.JComboBox;

import burp.BurpUtils;
import burp.api.montoya.core.ByteArray;
import de.usd.cstchef.Utils.MessageType;
import de.usd.cstchef.operations.Operation;
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.operations.Operation.OperationInfos;

@OperationInfos(name = "Remove Whitespace", category = OperationCategory.STRING, description = "Removes Spaces, Tabs or Newlines from input")
public class RemoveWhitespace extends Operation {

JComboBox<String> whitespaceSelection;

@Override
protected ByteArray perform(ByteArray input, MessageType messageType) throws Exception {
try {
if(input != null) {
String inputStr = input.toString();
String selection = (String)this.whitespaceSelection.getSelectedItem();
switch(selection){
case "Space":
inputStr = inputStr.replaceAll(" ", "");
break;
case "Newline":
inputStr = inputStr.replaceAll("\n", "");
break;
case "Tab":
inputStr = inputStr.replaceAll("\t", "");
break;
case "All":
inputStr = inputStr.replaceAll("[\n\t\s]*", "");
break;
default:
throw new IllegalArgumentException("Unkown whitespace type selection");
}

return factory.createByteArray(inputStr);
}
else {
return factory.createByteArray("");
}

} catch (Exception e) {
return input;
}
}

@Override
public void createUI() {
this.whitespaceSelection = new JComboBox<>(new String[] { "Space", "Newline", "Tab", "All"});
this.whitespaceSelection.setSelectedIndex(1);
this.addUIElement("Type: ", this.whitespaceSelection);
}
}
54 changes: 54 additions & 0 deletions src/main/java/de/usd/cstchef/operations/string/Strip.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package de.usd.cstchef.operations.string;

import javax.swing.JComboBox;

import burp.BurpUtils;
import burp.api.montoya.core.ByteArray;
import de.usd.cstchef.Utils.MessageType;
import de.usd.cstchef.operations.Operation;
import de.usd.cstchef.operations.OperationCategory;
import de.usd.cstchef.operations.Operation.OperationInfos;

@OperationInfos(name = "Strip", category = OperationCategory.STRING, description = "Strip Whitespace at beginning, end or both")
public class Strip extends Operation {

JComboBox<String> stripLocationSelection;

@Override
protected ByteArray perform(ByteArray input, MessageType messageType) throws Exception {
try {
if(input != null) {
String inputStr = input.toString();
String selection = (String)this.stripLocationSelection.getSelectedItem();
switch(selection){
case "Start":
inputStr = inputStr.stripLeading();
break;
case "End":
inputStr = inputStr.stripTrailing();
break;
case "Both":
inputStr = inputStr.stripLeading().stripTrailing();
break;
default:
throw new IllegalArgumentException("Unkown location selection");
}

return factory.createByteArray(inputStr);
}
else {
return factory.createByteArray("");
}

} catch (Exception e) {
return input;
}
}

@Override
public void createUI() {
this.stripLocationSelection = new JComboBox<>(new String[] { "Start", "End", "Both"});
this.stripLocationSelection.setSelectedIndex(0);
this.addUIElement("Strip at: ", this.stripLocationSelection);
}
}
14 changes: 14 additions & 0 deletions src/main/java/de/usd/cstchef/view/OperationsTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,20 @@ private void expandAll(TreePath path) {
this.expandPath(path);
}

public void expandAll(){
for(int i = 0; i < this.getRowCount(); i++){
TreePath path = this.getPathForRow(i);
this.expandAll(path);
}
}

public void collapseAll(){
for(int i = 0; i < this.getRowCount(); i++){
TreePath path = this.getPathForRow(i);
this.collapsePath(path);
}
}

public class CustomTreeUI extends BasicTreeUI {
@Override
protected boolean shouldPaintExpandControl(javax.swing.tree.TreePath path, int row, boolean isExpanded,
Expand Down
Loading

0 comments on commit fb37843

Please sign in to comment.