软件编程
位置:首页>> 软件编程>> java编程>> java批量解析微信dat文件

java批量解析微信dat文件

作者:b_eethoven  发布时间:2022-12-26 01:53:28 

标签:java,微信,dat文件

本文实例为大家分享了java批量解析微信dat文件的具体代码,供大家参考,具体内容如下

微信图片默认路径:C:\Users\b-eet\Documents\WeChat Files\b-eethoven\FileStorage\Image
微信文件利用Xor加密,计算之前需要知道异或值是多少。(好像每个人电脑上面的异或值都不同,在24行更改异或值)
异或值可用电脑自带的计算机计算(Xor)

java批量解析微信dat文件


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);
//
// }
// }
// }

}

来源:https://blog.csdn.net/weixin_42440768/article/details/88870077

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com