File tree Expand file tree Collapse file tree
cSploit/src/main/java/org/csploit/android/net/http Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -505,19 +505,21 @@ public static String getCharsetFromHeaders(String contentType){
505505 */
506506 public static String getCharsetFromBody (String body ) {
507507 if (body != null ) {
508- // match <body>, <body onLoad="">, etc...
509- int headEnd = body .toLowerCase ().indexOf ("</head>" );
508+ int headEnd = body .toLowerCase ().trim ().indexOf ("</head>" );
510509
511510 // return null if there's no head tags
512511 if (headEnd == -1 )
513512 return null ;
514513
515514 String body_head = body .toLowerCase ().substring (0 , headEnd );
516515
517- Pattern p = Pattern .compile ("charset=([\" a-z0-9A-Z-]+)" );
516+ Pattern p = Pattern .compile ("charset=([\" \' a-z0-9A-Z-]+)" );
518517 Matcher m = p .matcher (body_head );
519- if (m .find ())
520- return m .toMatchResult ().group (1 ).replaceAll ("\" " , "" );
518+ String str_match = "" ;
519+ if (m .find ()) {
520+ str_match = m .toMatchResult ().group (1 );
521+ return str_match .replaceAll ("[\" ']" , "" );
522+ }
521523 }
522524
523525 return null ;
You can’t perform that action at this time.
0 commit comments