Skip to content

Commit

Permalink
Merge pull request #165 from tsc-awardle/2022-bugfixes
Browse files Browse the repository at this point in the history
2022 bugfixes
  • Loading branch information
CoreyD97 authored Dec 2, 2022
2 parents 885cf6f + 3c98d2c commit a3c4c31
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/main/java/com/nccgroup/loggerplusplus/LoggerPlusPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

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

Expand Down Expand Up @@ -53,6 +54,21 @@ public LoggerPlusPlus(){
this.gsonProvider = new DefaultGsonProvider();
}

private JFrame getBurpFrame() throws Exception {
// Get all frames
Frame[] allFrames = JFrame.getFrames();
// Filter the stream find the main burp window frame, and convert to a list
List<Frame> filteredFrames = Arrays.stream(allFrames).filter(f ->
f.getTitle().startsWith("Burp Suite") && f.isVisible()
).collect(Collectors.toList());
// If size is 1, we have the main burp frame. Otherwise fails
if (filteredFrames.size() == 1) {
return (JFrame) filteredFrames.get(0);
} else {
throw new Exception("Expected one burp pane, but found " + filteredFrames.size());
}
}

@Override
public void registerExtenderCallbacks(final IBurpExtenderCallbacks callbacks)
{
Expand Down Expand Up @@ -98,7 +114,13 @@ public void registerExtenderCallbacks(final IBurpExtenderCallbacks callbacks)
LoggerPlusPlus.callbacks.addSuiteTab(mainViewController);

//Add menu item to Burp's frame menu.
JFrame rootFrame = (JFrame) SwingUtilities.getWindowAncestor(mainViewController.getUiComponent());
JFrame rootFrame = null;
try {
rootFrame = getBurpFrame();
} catch (Exception e) {
callbacks.printError("Could not find root frame. Window JMenu will not be added");
throw new RuntimeException(e);
}
try{
JMenuBar menuBar = rootFrame.getJMenuBar();
loggerMenu = new LoggerMenu(LoggerPlusPlus.this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public RequestViewerController(Preferences preferences, boolean requestEditable,
}

public void setDisplayedEntity(LogEntry logEntry) {
// Only update message if it's new. This fixes issue #164 and improves performance during heavy scanning.
if (this.currentEntry == logEntry) { return; }

this.currentEntry = logEntry;

if (logEntry == null) {
Expand Down

0 comments on commit a3c4c31

Please sign in to comment.