From 30b40b8b1b5cb1ce9c01fad60520ce7f379e5d38 Mon Sep 17 00:00:00 2001 From: Kremilly Date: Wed, 11 Dec 2024 17:53:02 -0300 Subject: [PATCH] feat: add application icon and Bootstrap CDN link to XSS report HTML generation --- src/constants/global.rs | 8 ++++++-- src/plugins/reports_xss.rs | 10 ++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/constants/global.rs b/src/constants/global.rs index 1d917e8..5b5819e 100644 --- a/src/constants/global.rs +++ b/src/constants/global.rs @@ -10,9 +10,13 @@ impl Global { pub const APP_CONFIGS: &'static str = "https://raw.githubusercontent.com/Kremilly/DumpSync/refs/heads/main/dumpsync.yml"; pub const XSS_DETECT_REGEX: &'static str = "https://raw.githubusercontent.com/Kremilly/DumpSync/refs/heads/main/patterns.txt"; - + + pub const APP_ICON: &'static str = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAYAAABxLuKEAAAACXBIWXMAAC4jAAAuIwF4pT92AAADSklEQVR4nO2aP07jQBSHf95si0QQQgihIBJRUAfJgtocAY4ARwhHIFfIEcgRNjXVuqFBCGEkhBBCKC5ow5stHENY/Gb8Z5zYu++Tpkk8+jlfZuyZZztKKQjf+bHoE6gqIoZBxDCIGAYRwyBiGEQMg4hhEDEMIoZBxDCIGAYRwyBiGEQMg4hhSCPGA6AstTGAXwB6Gc+zCeB82jdv7gWAk7SBjqmCp5TypidkGx/AoeM4oSG/O81vWsodOo5zbDrIKOb9/b0sMQDgNxqNPU12G8Bv2JMS0280Gme6A4xTSSlVZutOJhN2eCulekqpZgm5vclk0tb97p8mMURkOqQoXU22V2KuB2DAfVkFMew/R0Taf7Ug2ulZBTGVzDaKSfncaQBgmPB5E9FtMhcpsgMAp7ZzAXsjJlhaWholffH29pb1nLJkl5ILzGEqFem/qL6AvalUSv+CfbXrFEQLTJa6j5jmeDxurqysfFs9Ly8v93MHo/5iugDGr6+vQ0QjYLi6uhrkDpyh7mJijqbt/OXlJQAwitva2pp2L8ZRdTEhsu+T2oh20ScA8Pz8/CFpfX1de12ZpepiRohGQhG8acPT01MA4GxjYyNpzfUF4yaSiFK1Iv01fftEFKY9hxStTUQXj4+P57UWs7m56RPRIREFFuWAiHoPDw/aDaq1skOR/jparZbfarU6SqlTpdRQKRVaKj1oxVT6GjPL1tbWANMywf39fXzd8KApWxjQ9quNmFm2t7fjOw3u7u7a+BR0BEvVvlqKmaXT6QT4LDid3t7exoKyFty/UHsxf7Ozs+MD8G9ubv5dMdfX16Yi/HB3dzexPFn67nrBCzxTzTexFlM0F6i+mIX0BezVY7yrq6ukzwvdIVJkH5WRC9gbMR/7EZukLDvkXcdokacEDFUQw5YCiCiA5rlTWbnAHGq+KWDvLEqpAaK3HOaaCyx+xAxc19XdcgeIVrG2ryPaXMBi2SFH67uum/Sw7APXdUMiOiYif565QLqpFMIw7DIQIprbo4ODg1Rlxv39/QDA3uXlZTxy8oyezLnG92P+V+QdPAYRwyBiGEQMg4hhEDEMIoZBxDCIGAYRwyBiGEQMg4hhEDEMIoZBxDCIGAYRw/AHZ4ENamm/WDkAAAAASUVORK5CYII="; + + pub const CDN_BOOTSTRAP: &'static str = "https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"; + pub fn app_config() -> String { format!("{}.yml", Self::APP_NAME) } - + } diff --git a/src/plugins/reports_xss.rs b/src/plugins/reports_xss.rs index ae83cc5..8f28f12 100644 --- a/src/plugins/reports_xss.rs +++ b/src/plugins/reports_xss.rs @@ -84,14 +84,12 @@ impl ReportsXSS { pub fn html(&self, detections: Vec<(String, usize, String, String)>, output_path: &str) -> Result<(), Box> { let mut file = File::create(output_path)?; - file.write_all(b"XSS Reports")?; - file.write_all(b"")?; + file.write_all(b"XSS Reports")?; + file.write_all(format!("", Global::CDN_BOOTSTRAP).as_bytes())?; file.write_all(format!( - "", - Global::APP_NAME + "", + Global::APP_ICON, ).as_bytes())?; file.write_all(b"
")?;