Skip to content

Commit 903ef19

Browse files
committed
valid_XSS
1 parent 5a050c7 commit 903ef19

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

scanners/src/scan.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
extern crate scant3r_utils;
2-
use console::style;
32
use indicatif::{ProgressBar, ProgressStyle};
43
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
54
use scant3r_utils::requests::Msg;

scanners/src/scan/xss/mod.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use indicatif::ProgressBar;
66
use scant3r_utils::{
77
injector::{Injector, Urlinjector},
88
random_str,
9-
requests::{Curl, Msg, Resp},
9+
requests::{Curl, Msg},
1010
};
1111

1212
mod parser;
@@ -33,7 +33,7 @@ pub fn print_poc(report: &Report) -> String {
3333
pub fn csp_message(url: &str) -> String {
3434
format!(
3535
"{} {} {}: {}",
36-
style("[CSP]").yellow(),
36+
style("[CSP]").yellow().bold(),
3737
style(">>").blink(),
3838
style("Needs manual testing").yellow().bold(),
3939
url
@@ -128,7 +128,6 @@ pub fn valid_to_xss(req: &Msg) -> bool {
128128
})
129129
}
130130
Err(_e) => {
131-
println!("ERR\n\n\n\n");
132131
return false;
133132
}
134133
}
@@ -193,16 +192,10 @@ impl XssUrlParamsValue for Xss<'_> {
193192
req.url = self.injector.set_urlvalue(&param, &payload);
194193
let res = match req.send() {
195194
Ok(resp) => resp,
196-
Err(e) => {
197-
_prog.set_message(format!("CONNECTION ERROR: {}", e));
195+
Err(_e) => {
198196
continue;
199197
}
200198
};
201-
if res.headers.get("Content-Security-Policy").is_some() {
202-
if csp_check(res.headers.get("Content-Security-Policy").unwrap().to_str().unwrap()) {
203-
_prog.println(csp_message(&res.url.as_str()));
204-
}
205-
}
206199
for reflect in html_parse(&res.body.as_str(), &payload).iter() {
207200
let payload_generator =
208201
PayloadGen::new(&res.body.as_str(), reflect, &payload, &self.payloads);
@@ -213,6 +206,11 @@ impl XssUrlParamsValue for Xss<'_> {
213206
Ok(resp) => {
214207
let payload_found = html_search(resp.body.as_str(), &pay.search);
215208
if payload_found.len() > count.len() {
209+
if res.headers.get("Content-Security-Policy").is_some() {
210+
if csp_check(res.headers.get("Content-Security-Policy").unwrap().to_str().unwrap()) {
211+
_prog.println(csp_message(&res.url.as_str()));
212+
}
213+
}
216214
_found.push(Report {
217215
url: req.url.to_string(),
218216
match_payload: payload_found.clone(),

0 commit comments

Comments
 (0)