飞信聊天记录文件解密

前段时间,财务部的同事突然说飞信登录不了,经查发现飞信已经下线

而和飞信既无聊天记录导入,也无导出功能,联系中国移动未解决

建议不再使用此平台发送短信,然而数据还是要恢复的,因此...

 

注意:数据无价,执行代码前先对消息记录文件备份(位置:我的文档)

 

代码如下:


// szKeyName 为密码, 微信账号(文件夹名称)
int __stdcall FectionHistoryDecode(const char *srcFileName, const char *dstFileName, const char *szKeyName)
{
	HCRYPTPROV hProv = NULL;
	BOOL status = CryptAcquireContextA(&hProv, 0, "Microsoft Enhanced Cryptographic Provider v1.0", 1, 0xF0000000);
	if (status != FALSE)
	{
		HCRYPTHASH hHash = NULL;
		status = CryptCreateHash(hProv, 0x8004, 0, 0, &hHash);
		if (status != FALSE)
		{
			status = CryptHashData(hHash, (const BYTE *)szKeyName, strlen(szKeyName), 0);
			if (status != FALSE)
			{
				HCRYPTKEY hKey = NULL;
				status = CryptDeriveKey(hProv, 0x6801, hHash, 0, &hKey);
				if (status != FALSE)
				{
					status = FALSE;
					HANDLE hInput = CreateFileA(srcFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_READONLY, NULL);
					if (hInput != INVALID_HANDLE_VALUE)
					{
						HANDLE hOutput = CreateFileA(dstFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
						if (hOutput != INVALID_HANDLE_VALUE)
						{
							unsigned char buffer[1025] = { 0 };
							unsigned long length = 1024;
							DWORD dwReadBytes = 0;
							status = ReadFile(hInput, buffer, length, &dwReadBytes, NULL);
							while (status != FALSE)
							{
								status = CryptDecrypt(hKey, 0, TRUE, 0, buffer, (dwReadBytes > length ? &length : &dwReadBytes));
								if (status == FALSE)
								{
									break;
								}
								DWORD dwWriteBytes = 0;
								status = WriteFile(hOutput, buffer, dwReadBytes, &dwWriteBytes, NULL);
								if (status == FALSE || dwReadBytes < length)
								{
									break;
								}
								memset(buffer, 0, sizeof(buffer));
								status = ReadFile(hInput, buffer, length, &dwReadBytes, NULL);
							}
							CloseHandle(hOutput);
						}
						CloseHandle(hInput);
					}
					CryptDestroyKey(hKey);
				}
				// endif
			}
			CryptDestroyHash(hHash);
		}
		CryptReleaseContext(hProv, 0);
	}
	
	return status;
}

 

注意:数据无价,执行代码前先对消息记录文件备份(位置:我的文档)

 

doc end!

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值