@@ -6,7 +6,7 @@ use indicatif::ProgressBar;
66use scant3r_utils:: {
77 injector:: { Injector , Urlinjector } ,
88 random_str,
9- requests:: { Curl , Msg , Resp } ,
9+ requests:: { Curl , Msg } ,
1010} ;
1111
1212mod parser;
@@ -33,7 +33,7 @@ pub fn print_poc(report: &Report) -> String {
3333pub 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