diff --git a/src/plugins/reports_xss.rs b/src/plugins/reports_xss.rs index 3969a23..95fd99a 100644 --- a/src/plugins/reports_xss.rs +++ b/src/plugins/reports_xss.rs @@ -25,6 +25,24 @@ pub struct ReportsXSS; impl ReportsXSS { + pub fn txt(&self, detections: Vec<(String, usize, String, String)>, output_path: &str) -> Result<(), Box> { + let mut file = File::create(output_path)?; + + writeln!(file, "XSS Detection Report")?; + writeln!(file, "====================")?; + + for (table, row_index, column, value) in detections { + writeln!(file, "Table : {}", table)?; + writeln!(file, "Row : {}", row_index)?; + writeln!(file, "Column : {}", column)?; + writeln!(file, "Value : {}", value)?; + writeln!(file, "---------------------")?; + } + + ScanAlerts::reports_generated(output_path); + Ok(()) + } + pub fn csv(&self, detections: Vec<(String, usize, String, String)>, output_path: &str) -> Result<(), Box> { let mut writer = Writer::from_path(output_path)?; writer.write_record(&["Table", "Row Index", "Column", "Value"])?; diff --git a/src/plugins/scan_xss.rs b/src/plugins/scan_xss.rs index 6ccd54e..4d3e331 100644 --- a/src/plugins/scan_xss.rs +++ b/src/plugins/scan_xss.rs @@ -121,6 +121,8 @@ impl ScanXSS { if let Some(file) = &self.file { if file.ends_with(".csv") { ReportsXSS.csv(detections, file)?; + } else if file.ends_with(".txt") { + ReportsXSS.txt(detections, file)?; } else if file.ends_with(".json") { ReportsXSS.json(detections, file)?; } else if file.ends_with(".html") || file.ends_with(".htm") { diff --git a/src/ui/errors_alerts.rs b/src/ui/errors_alerts.rs index 3073ebe..bd6c080 100644 --- a/src/ui/errors_alerts.rs +++ b/src/ui/errors_alerts.rs @@ -50,7 +50,7 @@ impl ErrorsAlerts { } pub fn report_format() { - let message = "Invalid file format, only CSV, HTM, HTML and JSON are supported."; + let message = "Invalid file format, only TXT, CSV, HTM/HTML and JSON are supported."; println!("{}", "-".repeat(50)); println!(