Skip to content

Commit f23e7c5

Browse files
authored
Merge pull request #180 from nccgroup/develop
v3.20.0
2 parents 39d48e8 + a0d9e13 commit f23e7c5

File tree

88 files changed

+3221
-3298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+3221
-3298
lines changed

BappManifest.bmf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ Uuid: 470b7057b86f41c396a97903377f3d81
22
ExtensionType: 1
33
Name: Logger++
44
RepoName: logger-plus-plus
5-
ScreenVersion: 3.19.3a
5+
ScreenVersion: 3.20.0
66
SerialVersion: 20
77
MinPlatformVersion: 0
88
ProOnly: False
9-
Author: Soroush Dalili & Corey Arthur, NCC Group
9+
Author: Corey Arthur, NCC Group
1010
ShortDescription: Logs requests and responses for all Burp tools in a sortable table.
1111
EntryPoint: releases/LoggerPlusPlus.jar
1212
BuildCommand: gradle jar

build.gradle

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@ repositories {
1414
}
1515

1616
dependencies {
17-
compileOnly 'net.portswigger.burp.extender:burp-extender-api:2.3'
18-
// compileOnly 'net.portswigger.burp.extender:montoya-api:0.9.5'
19-
compileOnly 'org.projectlombok:lombok:1.18.24'
20-
annotationProcessor 'org.projectlombok:lombok:1.18.24'
21-
17+
implementation 'net.portswigger.burp.extensions:montoya-api:2023.5'
2218
implementation 'org.swinglabs:swingx:1.6.1'
23-
implementation 'com.github.CoreyD97:BurpExtenderUtilities:e800fd2d'
24-
implementation 'com.google.code.gson:gson:2.10'
25-
implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:7.5.2'
19+
implementation 'com.github.CoreyD97:Burp-Montoya-Utilities:234d21d'
20+
// implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:7.17.9'
21+
implementation 'co.elastic.clients:elasticsearch-java:8.6.2'
2622
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
2723
implementation 'org.apache.commons:commons-text:1.10.0'
2824
implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/burp/BurpExtender.java

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/java/com/nccgroup/loggerplusplus/LoggerContextMenuFactory.java

Lines changed: 39 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
package com.nccgroup.loggerplusplus;
22

3-
import burp.IContextMenuFactory;
4-
import burp.IContextMenuInvocation;
5-
import com.nccgroup.loggerplusplus.filter.colorfilter.ColorFilter;
6-
import com.nccgroup.loggerplusplus.filter.logfilter.LogFilter;
7-
import com.nccgroup.loggerplusplus.filter.parser.ParseException;
3+
import burp.api.montoya.core.Range;
4+
import burp.api.montoya.http.message.HttpMessage;
5+
import burp.api.montoya.ui.contextmenu.ContextMenuEvent;
6+
import burp.api.montoya.ui.contextmenu.ContextMenuItemsProvider;
7+
import burp.api.montoya.ui.contextmenu.MessageEditorHttpRequestResponse;
8+
import com.nccgroup.loggerplusplus.filter.colorfilter.TableColorRule;
89
import com.nccgroup.loggerplusplus.logentry.LogEntryField;
910
import com.nccgroup.loggerplusplus.logview.logtable.LogTable;
1011
import com.nccgroup.loggerplusplus.util.userinterface.dialog.ColorFilterDialog;
1112
import org.apache.commons.text.StringEscapeUtils;
1213

1314
import javax.swing.*;
15+
import java.awt.*;
1416
import java.awt.event.ActionEvent;
1517
import java.util.Arrays;
1618
import java.util.HashMap;
@@ -19,53 +21,50 @@
1921

2022
import static com.nccgroup.loggerplusplus.util.Globals.PREF_COLOR_FILTERS;
2123

22-
public class LoggerContextMenuFactory implements IContextMenuFactory {
23-
24-
private final LoggerPlusPlus loggerPlusPlus;
24+
public class LoggerContextMenuFactory implements ContextMenuItemsProvider {
2525

26-
public LoggerContextMenuFactory(LoggerPlusPlus loggerPlusPlus){
27-
this.loggerPlusPlus = loggerPlusPlus;
26+
public LoggerContextMenuFactory(){
2827
}
29-
28+
3029
@Override
31-
public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {
32-
if(invocation == null) return null;
30+
public List<Component> provideMenuItems(ContextMenuEvent event) {
3331
JMenuItem filterMenu = new JMenu("Logger++");
3432

35-
if (invocation.getSelectedMessages().length == 0 ||
36-
invocation.getSelectionBounds()[0] == invocation.getSelectionBounds()[1]) {
37-
return null;
38-
}
33+
//We're handling a message editor context menu
34+
//And we have a selection
35+
MessageEditorHttpRequestResponse requestResponse = event.messageEditorRequestResponse().orElseThrow();
36+
Range selectedRange = requestResponse.selectionOffsets().orElseThrow();
37+
HttpMessage target;
3938

4039
final LogEntryField context;
4140
final byte[] selectedBytes;
42-
switch (invocation.getInvocationContext()){
43-
case IContextMenuInvocation.CONTEXT_MESSAGE_EDITOR_REQUEST:
44-
case IContextMenuInvocation.CONTEXT_MESSAGE_VIEWER_REQUEST: {
41+
switch (event.invocationType()){
42+
case MESSAGE_EDITOR_REQUEST:
43+
case MESSAGE_VIEWER_REQUEST: {
44+
target = requestResponse.requestResponse().request();
4545
try {
46-
byte[] msg = invocation.getSelectedMessages()[0].getRequest();
47-
if (LoggerPlusPlus.callbacks.getHelpers().analyzeRequest(msg).getBodyOffset() > invocation.getSelectionBounds()[0]) {
46+
if (selectedRange.startIndexInclusive() <= target.bodyOffset()) {
4847
context = LogEntryField.REQUEST_HEADERS;
4948
} else {
5049
context = LogEntryField.REQUEST_BODY;
5150
}
52-
selectedBytes = Arrays.copyOfRange(invocation.getSelectedMessages()[0].getRequest(),
53-
invocation.getSelectionBounds()[0],invocation.getSelectionBounds()[1]);
51+
selectedBytes = Arrays.copyOfRange(target.toByteArray().getBytes(), selectedRange.startIndexInclusive(),
52+
selectedRange.endIndexExclusive());
5453
}catch (NullPointerException nPException){ return null; }
5554
break;
5655
}
5756

58-
case IContextMenuInvocation.CONTEXT_MESSAGE_EDITOR_RESPONSE:
59-
case IContextMenuInvocation.CONTEXT_MESSAGE_VIEWER_RESPONSE: {
57+
case MESSAGE_EDITOR_RESPONSE:
58+
case MESSAGE_VIEWER_RESPONSE: {
59+
target = requestResponse.requestResponse().response();
6060
try {
61-
byte[] msg = invocation.getSelectedMessages()[0].getResponse();
62-
if (LoggerPlusPlus.callbacks.getHelpers().analyzeRequest(msg).getBodyOffset() > invocation.getSelectionBounds()[0]) {
61+
if (selectedRange.startIndexInclusive() <= target.bodyOffset()) {
6362
context = LogEntryField.RESPONSE_HEADERS;
6463
} else {
6564
context = LogEntryField.RESPONSE_BODY;
6665
}
67-
selectedBytes = Arrays.copyOfRange(invocation.getSelectedMessages()[0].getResponse(),
68-
invocation.getSelectionBounds()[0], invocation.getSelectionBounds()[1]);
66+
selectedBytes = Arrays.copyOfRange(target.toByteArray().getBytes(), selectedRange.startIndexInclusive(),
67+
selectedRange.endIndexExclusive());
6968
} catch (NullPointerException nPException) {
7069
return null;
7170
}
@@ -75,15 +74,13 @@ public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {
7574
return null;
7675
}
7776

78-
if (selectedBytes != null) System.out.println(new String(selectedBytes));
79-
80-
final LogTable logTable = loggerPlusPlus.getLogViewController().getLogTableController().getLogTable();
77+
final LogTable logTable = LoggerPlusPlus.instance.getLogViewController().getLogTableController().getLogTable();
8178
String selectedText = StringEscapeUtils.escapeJava(new String(selectedBytes));
8279

8380
JMenuItem useAsFilter = new JMenuItem(new AbstractAction("Use Selection As LogFilter") {
8481
@Override
8582
public void actionPerformed(ActionEvent actionEvent) {
86-
loggerPlusPlus.getLogViewController().getLogFilterController().setFilter(context.getFullLabel() +
83+
LoggerPlusPlus.instance.getLogViewController().getLogFilterController().setFilter(context.getFullLabel() +
8784
" CONTAINS \"" + selectedText + "\"");
8885
}
8986
});
@@ -95,23 +92,23 @@ public void actionPerformed(ActionEvent actionEvent) {
9592
JMenuItem andFilter = new JMenuItem(new AbstractAction("AND") {
9693
@Override
9794
public void actionPerformed(ActionEvent actionEvent) {
98-
loggerPlusPlus.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " && "
95+
LoggerPlusPlus.instance.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " && "
9996
+ "" + context.getFullLabel() + " CONTAINS \"" + selectedText + "\"");
10097
}
10198
});
10299

103100
JMenuItem andNotFilter = new JMenuItem(new AbstractAction("AND NOT") {
104101
@Override
105102
public void actionPerformed(ActionEvent actionEvent) {
106-
loggerPlusPlus.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " && !("
103+
LoggerPlusPlus.instance.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " && !("
107104
+ "" + context.getFullLabel() + " CONTAINS \"" + selectedText + "\")");
108105
}
109106
});
110107

111108
JMenuItem orFilter = new JMenuItem(new AbstractAction("OR") {
112109
@Override
113110
public void actionPerformed(ActionEvent actionEvent) {
114-
loggerPlusPlus.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " || "
111+
LoggerPlusPlus.instance.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " || "
115112
+ context.getFullLabel() + " CONTAINS \"" + selectedText + "\"");
116113
}
117114
});
@@ -121,19 +118,13 @@ public void actionPerformed(ActionEvent actionEvent) {
121118
filterMenu.add(addToCurrentFilter);
122119
}
123120

124-
JMenuItem colorFilterItem = new JMenuItem(new AbstractAction("Set Selection as Color LogFilter") {
121+
JMenuItem colorFilterItem = new JMenuItem(new AbstractAction("Set Selection as Color Filter") {
125122
@Override
126123
public void actionPerformed(ActionEvent actionEvent) {
127-
try {
128-
ColorFilter colorFilter = new ColorFilter();
129-
colorFilter.setFilter(new LogFilter(loggerPlusPlus.getLibraryController(),
130-
context.getFullLabel() + " CONTAINS \"" + selectedText + "\""));
131-
HashMap<UUID,ColorFilter> colorFilters = loggerPlusPlus.getPreferencesController().getPreferences().getSetting(PREF_COLOR_FILTERS);
132-
colorFilters.put(colorFilter.getUUID(), colorFilter);
133-
new ColorFilterDialog(loggerPlusPlus.getLibraryController()).setVisible(true);
134-
} catch (ParseException e) {
135-
return;
136-
}
124+
TableColorRule tableColorRule = new TableColorRule("New Filter", context.getFullLabel() + " CONTAINS \"" + selectedText + "\"");
125+
HashMap<UUID, TableColorRule> colorFilters = LoggerPlusPlus.instance.getPreferencesController().getPreferences().getSetting(PREF_COLOR_FILTERS);
126+
colorFilters.put(tableColorRule.getUuid(), tableColorRule);
127+
new ColorFilterDialog(LoggerPlusPlus.instance.getLibraryController()).setVisible(true);
137128
}
138129
});
139130
filterMenu.add(colorFilterItem);

0 commit comments

Comments
 (0)