【微信.dat文件解码png】

电脑上微信的缓存实在是太大了,今天将微信缓存的照片清理一番

1. 图片存储路径

在这里插入图片描述

2. 查看加密方式

在这里插入图片描述
通过16进制编辑器查看文件初始字符。图片的加密格式一般通过异或对文件进行加密,因此我们需要找到进行异或的钥匙
一般jpg文件的文件头为FF D8 开头的,
因此,通过如下计算可以得出加密值。
在这里插入图片描述

3 程序

import os
import os
# 输出文件路径
out_path = r'D:\WeChat\**\Image\2020-04\\'

# 图片路径
path = r'D:\WeChat\**\Image\2020-04\\'

def imageDecode(f,fn):

    dat_read = open(f, "rb")

    # out='P:\\'+fn+".png"

    out=out_path+fn+".png"

    png_write = open(out, "wb")

    for now in dat_read:

        for nowByte in now:

            newByte = nowByte ^ 0x8e					# 此处修改为求出得值

            png_write.write(bytes([newByte]))

    dat_read.close()

    png_write.close()

 

def findFile(f):

    fsinfo = os.listdir(f)

    for fn in fsinfo:

        temp_path = os.path.join(f, fn)

        if not os.path.isdir(temp_path):

            print('文件路径: {}' .format(temp_path))

            print(fn)

            imageDecode(temp_path,fn)

        else:

            ...


findFile(path)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

fantongl

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值