java批量解析微信dat文件
人气:2微信图片默认路径:C:\Users\b-eet\Documents\WeChat Files\b-eethoven\FileStorage\Image
微信文件利用Xor加密,计算之前需要知道异或值是多少。(好像每个人电脑上面的异或值都不同,在24行更改异或值)
异或值可用电脑自带的计算机计算(Xor)
package cn.kgw; import java.io.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class WeChatImgRevert { public static void main(String[] args) { ExecutorService pool = Executors.newFixedThreadPool(10); Runnable r = () -> { String[] fileName = GetFileName.getFileName("D:/dat"); int i = 0; for (String name : fileName) { try (InputStream reader = new FileInputStream("D:/dat/" + name)) { try (OutputStream writer = new FileOutputStream("D:/photo/" + name + ".jpg")) { byte[] bytes = new byte[1024]; int b; while ((b = reader.read(bytes)) != -1) {//这里的in.read(bytes);就是把输入流中的东西,写入到内存中(buffer)。 // System.out.println("b = " + b + " b ^ 241 = " + (b ^ 241)); writer.write(b ^ 241);//241这个值是现算的,每个人电脑的值都不一致 writer.flush(); } } System.out.println(i++); } catch (Exception e) { e.printStackTrace(); } } }; pool.submit(r); pool.shutdown(); // System.out.println("--------------------------------"); // // ArrayList<String> listFileName = new ArrayList<String>(); // // GetFileName.getAllFileName("F:/dat", listFileName); // // for (String name : listFileName) { // System.out.println(name); // } } } class GetFileName { public static String[] getFileName(String path) { File file = new File(path); String[] fileName = file.list(); return fileName; } // public static void getAllFileName(String path, ArrayList<String> fileName) { // // File file = new File(path); // // File[] files = file.listFiles(); // // String[] names = file.list(); // // if (names != null) // // fileName.addAll(Arrays.asList(names)); // // for (File a : files) { // // if (a.isDirectory()) { // // getAllFileName(a.getAbsolutePath(), fileName); // // } // } // } }
加载全部内容