Skip to content

Commit

Permalink
Merge pull request #178 from nccgroup/develop
Browse files Browse the repository at this point in the history
Release v3.20.0
  • Loading branch information
CoreyD97 committed May 24, 2023
2 parents 0b4b50e + a0d9e13 commit aa8136a
Show file tree
Hide file tree
Showing 88 changed files with 3,221 additions and 3,298 deletions.
4 changes: 2 additions & 2 deletions BappManifest.bmf
Expand Up @@ -2,11 +2,11 @@ Uuid: 470b7057b86f41c396a97903377f3d81
ExtensionType: 1
Name: Logger++
RepoName: logger-plus-plus
ScreenVersion: 3.19.3a
ScreenVersion: 3.20.0
SerialVersion: 20
MinPlatformVersion: 0
ProOnly: False
Author: Soroush Dalili & Corey Arthur, NCC Group
Author: Corey Arthur, NCC Group
ShortDescription: Logs requests and responses for all Burp tools in a sortable table.
EntryPoint: releases/LoggerPlusPlus.jar
BuildCommand: gradle jar
Expand Down
12 changes: 4 additions & 8 deletions build.gradle
Expand Up @@ -14,15 +14,11 @@ repositories {
}

dependencies {
compileOnly 'net.portswigger.burp.extender:burp-extender-api:2.3'
// compileOnly 'net.portswigger.burp.extender:montoya-api:0.9.5'
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'

implementation 'net.portswigger.burp.extensions:montoya-api:2023.5'
implementation 'org.swinglabs:swingx:1.6.1'
implementation 'com.github.CoreyD97:BurpExtenderUtilities:e800fd2d'
implementation 'com.google.code.gson:gson:2.10'
implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:7.5.2'
implementation 'com.github.CoreyD97:Burp-Montoya-Utilities:234d21d'
// implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:7.17.9'
implementation 'co.elastic.clients:elasticsearch-java:8.6.2'
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
implementation 'org.apache.commons:commons-text:1.10.0'
implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
23 changes: 0 additions & 23 deletions src/main/java/burp/BurpExtender.java

This file was deleted.

@@ -1,16 +1,18 @@
package com.nccgroup.loggerplusplus;

import burp.IContextMenuFactory;
import burp.IContextMenuInvocation;
import com.nccgroup.loggerplusplus.filter.colorfilter.ColorFilter;
import com.nccgroup.loggerplusplus.filter.logfilter.LogFilter;
import com.nccgroup.loggerplusplus.filter.parser.ParseException;
import burp.api.montoya.core.Range;
import burp.api.montoya.http.message.HttpMessage;
import burp.api.montoya.ui.contextmenu.ContextMenuEvent;
import burp.api.montoya.ui.contextmenu.ContextMenuItemsProvider;
import burp.api.montoya.ui.contextmenu.MessageEditorHttpRequestResponse;
import com.nccgroup.loggerplusplus.filter.colorfilter.TableColorRule;
import com.nccgroup.loggerplusplus.logentry.LogEntryField;
import com.nccgroup.loggerplusplus.logview.logtable.LogTable;
import com.nccgroup.loggerplusplus.util.userinterface.dialog.ColorFilterDialog;
import org.apache.commons.text.StringEscapeUtils;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.Arrays;
import java.util.HashMap;
Expand All @@ -19,53 +21,50 @@

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

public class LoggerContextMenuFactory implements IContextMenuFactory {

private final LoggerPlusPlus loggerPlusPlus;
public class LoggerContextMenuFactory implements ContextMenuItemsProvider {

public LoggerContextMenuFactory(LoggerPlusPlus loggerPlusPlus){
this.loggerPlusPlus = loggerPlusPlus;
public LoggerContextMenuFactory(){
}

@Override
public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {
if(invocation == null) return null;
public List<Component> provideMenuItems(ContextMenuEvent event) {
JMenuItem filterMenu = new JMenu("Logger++");

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

final LogEntryField context;
final byte[] selectedBytes;
switch (invocation.getInvocationContext()){
case IContextMenuInvocation.CONTEXT_MESSAGE_EDITOR_REQUEST:
case IContextMenuInvocation.CONTEXT_MESSAGE_VIEWER_REQUEST: {
switch (event.invocationType()){
case MESSAGE_EDITOR_REQUEST:
case MESSAGE_VIEWER_REQUEST: {
target = requestResponse.requestResponse().request();
try {
byte[] msg = invocation.getSelectedMessages()[0].getRequest();
if (LoggerPlusPlus.callbacks.getHelpers().analyzeRequest(msg).getBodyOffset() > invocation.getSelectionBounds()[0]) {
if (selectedRange.startIndexInclusive() <= target.bodyOffset()) {
context = LogEntryField.REQUEST_HEADERS;
} else {
context = LogEntryField.REQUEST_BODY;
}
selectedBytes = Arrays.copyOfRange(invocation.getSelectedMessages()[0].getRequest(),
invocation.getSelectionBounds()[0],invocation.getSelectionBounds()[1]);
selectedBytes = Arrays.copyOfRange(target.toByteArray().getBytes(), selectedRange.startIndexInclusive(),
selectedRange.endIndexExclusive());
}catch (NullPointerException nPException){ return null; }
break;
}

case IContextMenuInvocation.CONTEXT_MESSAGE_EDITOR_RESPONSE:
case IContextMenuInvocation.CONTEXT_MESSAGE_VIEWER_RESPONSE: {
case MESSAGE_EDITOR_RESPONSE:
case MESSAGE_VIEWER_RESPONSE: {
target = requestResponse.requestResponse().response();
try {
byte[] msg = invocation.getSelectedMessages()[0].getResponse();
if (LoggerPlusPlus.callbacks.getHelpers().analyzeRequest(msg).getBodyOffset() > invocation.getSelectionBounds()[0]) {
if (selectedRange.startIndexInclusive() <= target.bodyOffset()) {
context = LogEntryField.RESPONSE_HEADERS;
} else {
context = LogEntryField.RESPONSE_BODY;
}
selectedBytes = Arrays.copyOfRange(invocation.getSelectedMessages()[0].getResponse(),
invocation.getSelectionBounds()[0], invocation.getSelectionBounds()[1]);
selectedBytes = Arrays.copyOfRange(target.toByteArray().getBytes(), selectedRange.startIndexInclusive(),
selectedRange.endIndexExclusive());
} catch (NullPointerException nPException) {
return null;
}
Expand All @@ -75,15 +74,13 @@ public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) {
return null;
}

if (selectedBytes != null) System.out.println(new String(selectedBytes));

final LogTable logTable = loggerPlusPlus.getLogViewController().getLogTableController().getLogTable();
final LogTable logTable = LoggerPlusPlus.instance.getLogViewController().getLogTableController().getLogTable();
String selectedText = StringEscapeUtils.escapeJava(new String(selectedBytes));

JMenuItem useAsFilter = new JMenuItem(new AbstractAction("Use Selection As LogFilter") {
@Override
public void actionPerformed(ActionEvent actionEvent) {
loggerPlusPlus.getLogViewController().getLogFilterController().setFilter(context.getFullLabel() +
LoggerPlusPlus.instance.getLogViewController().getLogFilterController().setFilter(context.getFullLabel() +
" CONTAINS \"" + selectedText + "\"");
}
});
Expand All @@ -95,23 +92,23 @@ public void actionPerformed(ActionEvent actionEvent) {
JMenuItem andFilter = new JMenuItem(new AbstractAction("AND") {
@Override
public void actionPerformed(ActionEvent actionEvent) {
loggerPlusPlus.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " && "
LoggerPlusPlus.instance.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " && "
+ "" + context.getFullLabel() + " CONTAINS \"" + selectedText + "\"");
}
});

JMenuItem andNotFilter = new JMenuItem(new AbstractAction("AND NOT") {
@Override
public void actionPerformed(ActionEvent actionEvent) {
loggerPlusPlus.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " && !("
LoggerPlusPlus.instance.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " && !("
+ "" + context.getFullLabel() + " CONTAINS \"" + selectedText + "\")");
}
});

JMenuItem orFilter = new JMenuItem(new AbstractAction("OR") {
@Override
public void actionPerformed(ActionEvent actionEvent) {
loggerPlusPlus.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " || "
LoggerPlusPlus.instance.getLogViewController().getLogFilterController().setFilter(logTable.getCurrentFilter().toString() + " || "
+ context.getFullLabel() + " CONTAINS \"" + selectedText + "\"");
}
});
Expand All @@ -121,19 +118,13 @@ public void actionPerformed(ActionEvent actionEvent) {
filterMenu.add(addToCurrentFilter);
}

JMenuItem colorFilterItem = new JMenuItem(new AbstractAction("Set Selection as Color LogFilter") {
JMenuItem colorFilterItem = new JMenuItem(new AbstractAction("Set Selection as Color Filter") {
@Override
public void actionPerformed(ActionEvent actionEvent) {
try {
ColorFilter colorFilter = new ColorFilter();
colorFilter.setFilter(new LogFilter(loggerPlusPlus.getLibraryController(),
context.getFullLabel() + " CONTAINS \"" + selectedText + "\""));
HashMap<UUID,ColorFilter> colorFilters = loggerPlusPlus.getPreferencesController().getPreferences().getSetting(PREF_COLOR_FILTERS);
colorFilters.put(colorFilter.getUUID(), colorFilter);
new ColorFilterDialog(loggerPlusPlus.getLibraryController()).setVisible(true);
} catch (ParseException e) {
return;
}
TableColorRule tableColorRule = new TableColorRule("New Filter", context.getFullLabel() + " CONTAINS \"" + selectedText + "\"");
HashMap<UUID, TableColorRule> colorFilters = LoggerPlusPlus.instance.getPreferencesController().getPreferences().getSetting(PREF_COLOR_FILTERS);
colorFilters.put(tableColorRule.getUuid(), tableColorRule);
new ColorFilterDialog(LoggerPlusPlus.instance.getLibraryController()).setVisible(true);
}
});
filterMenu.add(colorFilterItem);
Expand Down

0 comments on commit aa8136a

Please sign in to comment.