MCPcopy Create free account
hub / github.com/f0ng/captcha-killer-modified / dataimgToimg

Method dataimgToimg

src/main/java/utils/Util.java:111–130  ·  view source on GitHub ↗
(String str_img)

Source from the content-addressed store, hash-verified

109 }
110
111 public static byte[] dataimgToimg(String str_img) throws IOException {
112 String pattern = "(data:image.*?)[\"|&]|(data%2Aimage.*?)[\"|&]";
113 str_img = str_img.replace("\\r\\n","");
114 str_img = str_img.replace("\\n","").replace("\\","");
115 str_img = str_img.replace("_","/").replace("-","+");
116// stdout.println(str_img);
117 str_img = URLDecoder.decode(str_img,"utf-8");
118 Pattern r = Pattern.compile(pattern);
119 Matcher m = r.matcher(str_img);
120 if (m.find( )) {
121 str_img = m.group(0).replace("\"","").replace("&","").replace("Base64:","").replace("base64:","").replace(".","") ;
122 }
123 if (!str_img.contains("data:image")){
124 str_img = "data:image/jpeg;base64," + str_img;
125 }
126 str_img = str_img.replace(" ","+");
127 byte[] img = DatatypeConverter.parseBase64Binary(str_img.substring(str_img.indexOf(",") + 1));
128// InputStream buffin = new ByteArrayInputStream(img);
129 return img;
130 }
131
132 public static String extractToken(String str_img,String token) throws IOException {
133 String pattern = token ;

Callers 3

encdoeLableMethod · 0.80
runMethod · 0.80
getValueAtMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected