Skip to content

Commit

Permalink
refactor: improve HTML structure and styling in XSS report generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kremilly committed Dec 11, 2024
1 parent 1c38f3b commit a8b451d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/plugins/reports_xss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ impl ReportsXSS {
pub fn html(&self, detections: Vec<(String, usize, String, String)>, output_path: &str) -> Result<(), Box<dyn Error>> {
let mut file = File::create(output_path)?;
file.write_all(b"<html><head><title>XSS Reports</title><link href='https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css' rel='stylesheet'></head>")?;
file.write_all(b"<body><table class='table'>")?;
file.write_all(b"<tr><th>Table</th><th stryle='padding: 5px !important;'>Row Index</th><th>Column</th><th>Value</th></tr>")?;
file.write_all(b"<body>")?;
file.write_all(b"<div class='container-fluid gap-3'><table class='table table-striped table-bordered table-hover'>")?;
file.write_all(b"<tr><th>Table</th><th>Row Index</th><th>Column</th><th>Value</th></tr>")?;

for (table, row_index, column, value) in detections {
let encoded_table = ReportsHandlers.html_escape(&table);
Expand All @@ -98,7 +99,7 @@ impl ReportsXSS {
).as_bytes())?;
}

file.write_all(b"</table></body></html>")?;
file.write_all(b"</table></div></body></html>")?;

ReportAlerts::generated(output_path);
Ok(())
Expand Down

0 comments on commit a8b451d

Please sign in to comment.