4 Commits

Author SHA1 Message Date
Suxue
affafe324f fix bug 2024-01-09 20:49:30 +08:00
Suxue
ef3c84a724 v0.9.7.0 Releases!
1.优化解密的内存开销,同时修复大于2gb文件解密出错的问题。
2.现在起工作区加载联系人也开始为异步操作了。
3.现在起工作区查看聊天记录改为分页查看了。
4.保底版本支持3.9.8.25。
2024-01-09 20:33:00 +08:00
Suxue
0f70591cdb v0.9.6.4 Release!
1.新增部分消息容错。
2.新增已删除但有消息记录的人员记录导出。
2024-01-06 11:25:14 +08:00
Suxue
029403e8ae v0.9.6.3 Release!
1.新增引用消息支持。
2.词云分词异常时错误提示。
2023-12-23 00:07:43 +08:00
9 changed files with 76 additions and 75 deletions

View File

@@ -11,7 +11,7 @@ namespace WechatBakTool.Export
public interface IExport
{
void InitTemplate(WXContact session,string path);
bool SetMsg(WXUserReader reader, WXContact session, WorkspaceViewModel viewModel);
void SetMsg(WXUserReader reader, WXContact session, WorkspaceViewModel viewModel);
void SetEnd();
void Save(string path = "");
}

View File

@@ -28,6 +28,7 @@ namespace WechatBakTool.Export
HtmlBody += string.Format("<div class=\"msg\"><p class=\"nickname\"><b>与 {0}({1}) 的聊天记录</b></p>", Session.NickName, Session.UserName);
HtmlBody += string.Format("<div class=\"msg\"><p class=\"nickname\"><b>导出时间:{0}</b></p><hr/>", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
File.WriteAllText(Path, HtmlBody);
}
public void InitTemplate(WXContact contact, string p)
@@ -50,7 +51,7 @@ namespace WechatBakTool.Export
File.AppendAllText(Path, HtmlBody);
}
public bool SetMsg(WXUserReader reader, WXContact contact,WorkspaceViewModel viewModel)
public void SetMsg(WXUserReader reader, WXContact contact,WorkspaceViewModel viewModel)
{
if (Session == null)
throw new Exception("请初始化模版Not Use InitTemplate");
@@ -59,16 +60,11 @@ namespace WechatBakTool.Export
if (msgList == null)
throw new Exception("获取消息失败,请确认数据库读取正常");
if(msgList.Count == 0)
{
viewModel.ExportCount = "没有消息,忽略";
return false;
}
msgList.Sort((x, y) => x.CreateTime.CompareTo(y.CreateTime));
bool err = false;
int msgCount = 0;
HtmlBody = "";
StreamWriter streamWriter = new StreamWriter(Path, true);
foreach (var msg in msgList)
{
@@ -344,7 +340,7 @@ namespace WechatBakTool.Export
}
streamWriter.Close();
streamWriter.Dispose();
return true;
}
private static DateTime TimeStampToDateTime(long timeStamp, bool inMilli = false)
{

View File

@@ -40,7 +40,7 @@ namespace WechatBakTool.Export
}
public bool SetMsg(WXUserReader reader, WXContact session, WorkspaceViewModel viewModel)
public void SetMsg(WXUserReader reader, WXContact session, WorkspaceViewModel viewModel)
{
if (Contact == null)
throw new Exception("请初始化模版Not Use InitTemplate");
@@ -146,7 +146,6 @@ namespace WechatBakTool.Export
msgCount++;
viewModel.ExportCount = msgCount.ToString();
}
return true;
}
private static DateTime TimeStampToDateTime(long timeStamp, bool inMilli = false)

View File

@@ -136,24 +136,9 @@ namespace WechatBakTool.Helpers
throw new Exception("搜索不到微信账号,请确认用户名是否正确,如错误请重新新建工作区,务必确认账号是否正确");
}
}
else if (find_key_type == 3)
{
string searchString = "-----BEGIN PUBLIC KEY-----";
}
return null;
}
public static string GetMD5(string text)
{
MD5 md5 = MD5.Create();
byte[] bs = Encoding.UTF8.GetBytes(text);
byte[] hs = md5.ComputeHash(bs);
StringBuilder sb = new StringBuilder();
foreach(byte b in hs)
{
sb.Append(b.ToString("x2"));
}
return sb.ToString();
}
public static void DecryptDB(string file, string to_file, byte[] password_bytes)
{
//数据库头16字节是盐值
@@ -203,6 +188,7 @@ namespace WechatBakTool.Helpers
// 分页标志
var page_bytes = BitConverter.GetBytes(page_no + 1);
page_bytes = page_bytes.Take(4).ToArray();
page_bytes.CopyTo(going_to_hashed, DEFAULT_PAGESIZE - reserved - offset + IV_SIZE);
var hash_mac_compute = hmac_sha1.ComputeHash(going_to_hashed, 0, going_to_hashed.Length);
@@ -241,7 +227,7 @@ namespace WechatBakTool.Helpers
byte[] reserved_byte = new byte[reserved];
fileStream.Seek((page_no * DEFAULT_PAGESIZE) + DEFAULT_PAGESIZE - reserved, SeekOrigin.Begin);
fileStream.Read(reserved_byte, 0, Convert.ToInt32(reserved));
reserved_byte.CopyTo(decryped_page_bytes, DEFAULT_PAGESIZE - reserved);
reserved_byte.CopyTo(decryped_page_bytes, Convert.ToInt32(DEFAULT_PAGESIZE - reserved));
tofileStream.Write(decryped_page_bytes, 0, decryped_page_bytes.Length);

View File

@@ -156,13 +156,7 @@ namespace WechatBakTool.Pages
{
if (File.Exists("auth.txt"))
{
string auth = File.ReadAllText("auth.txt");
// 我已知晓手动模式可能潜在的法律及道德风险,我明白非法使用将要承担相关法律责任。
if (DecryptionHelper.GetMD5(auth) == "295f634af60d61dfa52a5f35849ac42b")
{
MessageBox.Show("已经创建空的配置文件,请完善该配置文件后,点击开始解密","提示");
MessageBox.Show("该功能现阶段暂未启用","错误");
}
}
else
{

View File

@@ -6,7 +6,6 @@ using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
@@ -31,8 +30,6 @@ namespace WechatBakTool.Pages
{
private WorkspaceViewModel workspaceViewModel = new WorkspaceViewModel();
public WXUserReader? UserReader;
private List<WXContact>? ExpContacts;
private bool Suspend = false;
public Manager()
{
DataContext = workspaceViewModel;
@@ -64,25 +61,15 @@ namespace WechatBakTool.Pages
});
if (UserReader != null)
{
if (!Suspend)
ExpContacts = UserReader.GetWXContacts().ToList();
else
Suspend = false;
foreach (var contact in ExpContacts!)
List<WXContact>? contacts = UserReader.GetWXContacts().ToList();
foreach (var contact in contacts)
{
if (Suspend)
{
workspaceViewModel.ExportCount = "已暂停";
return;
}
if (group && contact.UserName.Contains("@chatroom"))
{
workspaceViewModel.WXContact = contact;
ExportMsg(contact);
}
if (user && !contact.UserName.Contains("@chatroom") && !contact.UserName.Contains("gh_"))
if (user)
{
workspaceViewModel.WXContact = contact;
ExportMsg(contact);
@@ -96,27 +83,12 @@ namespace WechatBakTool.Pages
private void ExportMsg(WXContact contact)
{
workspaceViewModel.ExportCount = "";
// string path = Path.Combine(Main2.CurrentUserBakConfig!.UserWorkspacePath, contact.UserName + ".html");
string name = contact.NickName;
name = name.Replace(@"\", "");
name = Regex.Replace(name, "[ \\[ \\] \\^ \\-_*×――(^)$%~!/@#$…&%¥—+=<>《》|!??::•`·、。,;,.;\"‘’“”-]", "");
string path = Path.Combine(
Main2.CurrentUserBakConfig!.UserWorkspacePath,
string.Format(
"{0}-{1}.html",
contact.UserName,
contact.Remark == "" ? name : contact.Remark
)
);
string path = Path.Combine(Main2.CurrentUserBakConfig!.UserWorkspacePath, contact.UserName + ".html");
IExport export = new HtmlExport();
export.InitTemplate(contact, path);
if(export.SetMsg(UserReader!, contact, workspaceViewModel))
{
export.SetEnd();
export.Save(path);
}
export.SetMsg(UserReader!, contact, workspaceViewModel);
export.SetEnd();
export.Save(path);
}
private void btn_emoji_download_Click(object sender, RoutedEventArgs e)

View File

@@ -328,6 +328,61 @@ namespace WechatBakTool.Pages
MessageBox.Show("用户所有表情预下载完毕");
});
}
/*
if (UserReader != null && ViewModel.WXContact != null)
{
Task.Run(() =>
{
List<WXMsg> msgs = UserReader.GetWXMsgs(ViewModel.WXContact.UserName).ToList();
List<WXContactHT> users = new List<WXContactHT>();
if (File.Exists("WXContact.json"))
{
string text = File.ReadAllText("WXContact.json");
text = text.Substring(8, text.Length - 8);
users = JsonConvert.DeserializeObject<List<WXContactHT>>(text);
}
int i = 1; int all = 1;
List<WXMsg> tmp = new List<WXMsg>();
foreach (WXMsg m in msgs)
{
m.BytesExtra = null;
tmp.Add(m);
if (all % 10000 == 0)
{
File.WriteAllText(ViewModel.WXContact.UserName + "-" + i.ToString() + ".json", string.Format("showMsg({0})", JsonConvert.SerializeObject(tmp)));
tmp.Clear();
i++;
}
all++;
}
if (users!.Find(x => x.UserName == ViewModel.WXContact.UserName) == null)
{
WXContactHT html = new WXContactHT();
html.NickName = ViewModel.WXContact.NickName;
html.UserName = ViewModel.WXContact.UserName;
html.LastMsg = ViewModel.WXContact.LastMsg;
if (ViewModel.WXContact.Avatar != null)
{
using (var ms = new MemoryStream())
{
ViewModel.WXContact.Avatar.StreamSource.CopyTo(ms);
byte[] bytes = new byte[ms.Length];
ms.Write(bytes, 0, bytes.Length);
html.AvatarString = Convert.ToBase64String(bytes);
}
}
html.FileCount = i;
users.Add(html);
}
File.WriteAllText(ViewModel.WXContact.UserName + "-" + i.ToString() + ".json", string.Format("showMsg({0})", JsonConvert.SerializeObject(tmp)));
File.WriteAllText("WXContact.json", string.Format("getUser({0})", JsonConvert.SerializeObject(users)));
MessageBox.Show("json已导出");
});
}
*/
}
private void list_msg_ScrollChanged(object sender, ScrollChangedEventArgs e)

View File

@@ -22,7 +22,6 @@
> [!NOTE]
> 反馈群815054692<br/>
> 如果觉得不错欢迎右上角点个star这是对作者的鼓励谢谢<br/>
> 进群请先Star项目然后问答消息留id<br/>
<br/>
### 免责声明
@@ -74,7 +73,7 @@ A基本上都是因为刚迁移完缓存没写入到数据库导致的
### 参考/引用
项目在开发过程中参考了以下项目或资料,有引用相关代码,如有需要,推荐您可以去参考下相关资料:
1. C#使用OpenSSL解密微信数据库这里注意一下64位适配问题注意dll引用另外解密的资源优化不是很好可以参考一下我改写的C#还需要注意一下超大文件的问题 [Mr0x01/WXDBDecrypt.NET](https://github.com/Mr0x01/WXDBDecrypt.NET)<br/>
1. C#使用OpenSSL解密微信数据库这里注意一下64位适配问题注意dll引用 [Mr0x01/WXDBDecrypt.NET](https://github.com/Mr0x01/WXDBDecrypt.NET)<br/>
2. C#使用地址获取微信Key [AdminTest0/SharpWxDump](https://github.com/AdminTest0/SharpWxDump)
3. 解密微信语音我是直接调用解密反正都要ffmpeg多一个也是多多两个也是多懒得头铁实现 [kn007/silk-v3-decoder](https://github.com/kn007/silk-v3-decoder)
4. 解密微信图片 [吾爱破解chenhahacjl/微信 DAT 图片解密 C#](https://www.52pojie.cn/forum.php?mod=viewthread&tid=1507922)

View File

@@ -6,9 +6,9 @@
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.9.6.4</AssemblyVersion>
<FileVersion>0.9.6.4</FileVersion>
<Version>0.9.6.4</Version>
<AssemblyVersion>0.9.7.0</AssemblyVersion>
<FileVersion>0.9.7.0</FileVersion>
<Version>0.9.7.0</Version>
</PropertyGroup>
<ItemGroup>