Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2022 bugfixes #165

Merged
merged 2 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.getRequest() != null) {
Expand Down