Skip to content

Commit

Permalink
Improve copy/paste from vuln report
Browse files Browse the repository at this point in the history
- Fixes #96005: select/copy issue on vuln report
  • Loading branch information
ron190 committed Feb 6, 2025
1 parent 14c7038 commit e652e1c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
14 changes: 7 additions & 7 deletions model/src/main/java/com/jsql/model/InjectionModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,20 +271,20 @@ public String inject(

if (isReport) {
Color colorReport = UIManager.getColor("TextArea.inactiveForeground");
String report = "<br>" + StringUtil.formatReport(colorReport, "Method: ") + httpRequest.method();
report += "<br>" + StringUtil.formatReport(colorReport, "Path: ") + httpRequest.uri().getPath();
String report = "<br>&#10;" + StringUtil.formatReport(colorReport, "Method: ") + httpRequest.method();
report += "<br>&#10;" + StringUtil.formatReport(colorReport, "Path: ") + httpRequest.uri().getPath();
if (httpRequest.uri().getQuery() != null) {
report += "<br>" + StringUtil.formatReport(colorReport, "Query: ") + httpRequest.uri().getQuery();
report += "<br>&#10;" + StringUtil.formatReport(colorReport, "Query: ") + httpRequest.uri().getQuery();
}
if (
!(this.mediatorUtils.getParameterUtil().getListRequest().isEmpty()
&& this.mediatorUtils.getCsrfUtil().getTokenCsrf() == null)
) {
report += "<br>" + StringUtil.formatReport(colorReport, "Body: ") + body;
report += "<br>&#10;" + StringUtil.formatReport(colorReport, "Body: ") + body;
}
report += "<br>" + StringUtil.formatReport(colorReport, "Header: ") + httpRequest.headers().map().entrySet().stream()
report += "<br>&#10;" + StringUtil.formatReport(colorReport, "Header: ") + httpRequest.headers().map().entrySet().stream()
.map(entry -> String.format("%s: %s", entry.getKey(), String.join(StringUtils.EMPTY, entry.getValue())))
.collect(Collectors.joining("<br>"));
.collect(Collectors.joining("<br>&#10;"));
return report;
}

Expand Down Expand Up @@ -702,6 +702,6 @@ public void appendAnalysisReport(String analysisReport) {
}

public void appendAnalysisReport(String analysisReport, boolean isInit) {
this.analysisReport += (isInit ? StringUtils.EMPTY : "<br><br>") + analysisReport;
this.analysisReport += (isInit ? StringUtils.EMPTY : "<br>&#10;<br>&#10;") + analysisReport;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ public Vendor fingerprintVendor() {
String.join(
StringUtils.EMPTY,
"# Date: ", LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE),
"<br># Tested on: ", SystemUtils.OS_NAME, " (", SystemUtils.OS_VERSION, ")",
"<br># Tool: ", StringUtil.APP_NAME, " v", this.injectionModel.getPropertiesUtil().getVersionJsql(),
"<br>&#10;# Tested on: ", SystemUtils.OS_NAME, " (", SystemUtils.OS_VERSION, ")",
"<br>&#10;# Tool: ", StringUtil.APP_NAME, " v", this.injectionModel.getPropertiesUtil().getVersionJsql(),
" (<a href=", urlGitHub, ">", urlGitHub, "</a>)",
"<br># Database: ", vendorFound.toString(),
"<br><br>## Vulnerability summary</span>"
"<br>&#10;# Database: ", vendorFound.toString(),
"<br>&#10;<br>&#10;## Vulnerability summary</span>"
),
true
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import javax.swing.*;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumnModel;
import javax.swing.text.JTextComponent;
import javax.swing.text.StyleConstants;
import java.awt.*;
import java.awt.event.InputEvent;
Expand Down Expand Up @@ -112,7 +113,7 @@ private JMenu initMenuEdit() {
if (MediatorHelper.tabResults().getSelectedComponent() instanceof PanelTable) {
((PanelTable) MediatorHelper.tabResults().getSelectedComponent()).copyTable();
} else if (MediatorHelper.tabResults().getSelectedComponent() instanceof JScrollPane) {
((JTextArea) ((JScrollPane) MediatorHelper.tabResults().getSelectedComponent()).getViewport().getView()).copy();
((JTextComponent) ((JScrollPane) MediatorHelper.tabResults().getSelectedComponent()).getViewport().getView()).copy();
}
});

Expand All @@ -125,7 +126,7 @@ private JMenu initMenuEdit() {
} else if (MediatorHelper.tabResults().getSelectedComponent() instanceof JScrollPane) {
// Textarea need focus to select all
((JScrollPane) MediatorHelper.tabResults().getSelectedComponent()).getViewport().getView().requestFocusInWindow();
((JTextArea) ((JScrollPane) MediatorHelper.tabResults().getSelectedComponent()).getViewport().getView()).selectAll();
((JTextComponent) ((JScrollPane) MediatorHelper.tabResults().getSelectedComponent()).getViewport().getView()).selectAll();
}
});

Expand Down

0 comments on commit e652e1c

Please sign in to comment.