解锁并提取Linux客户端微信数据库 (vibe coded)
at 55 lines 2.4 kB view raw
1# -*- coding: utf-8 -*-# 2# ------------------------------------------------------------------------------- 3# Name: Sns.py 4# Description: 负责处理朋友圈相关数据 软件只能看到在电脑微信浏览过的朋友圈记录 5# Author: xaoyaoo 6# Date: 2024/04/15 7# ------------------------------------------------------------------------------- 8import json 9 10from .db_base import DatabaseBase 11from .utils import silk2audio, xml2dict, timestamp2str 12 13 14# FeedsV20:朋友圈的XML数据 15# CommentV20:朋友圈点赞或评论记录 16# NotificationV7:朋友圈通知 17# SnsConfigV20:一些配置信息,能读懂的是其中有你的朋友圈背景图 18# SnsGroupInfoV5:猜测是旧版微信朋友圈可见范围的可见或不可见名单 19 20class SnsHandler(DatabaseBase): 21 _class_name = "Sns" 22 Media_required_tables = ["AdFeedsV8", "FeedsV20", "CommentV20", "NotificationV7", "SnsConfigV20", "SnsFailureV5", 23 "SnsGroupInfoV5", "SnsNoNotifyV5"] 24 25 def get_sns_feed(self): 26 """ 27 获取朋友圈数据 28 http://shmmsns.qpic.cn/mmsns/uGxMq1C4wvppcjBbyweK796GtT1hH3LGISYajZ2v7C11XhHk5icyDUXcWNSPk2MooeIa8Es5hXP0/0?idx=1&token=WSEN6qDsKwV8A02w3onOGQYfxnkibdqSOkmHhZGNB4DFumlE9p1vp0e0xjHoXlbbXRzwnQia6X5t3Annc4oqTuDg 29 """ 30 sql = ( 31 "SELECT FeedId, CreateTime, FaultId, Type, UserName, Status, ExtFlag, PrivFlag, StringId, Content " 32 "FROM FeedsV20 " 33 "ORDER BY CreateTime DESC") 34 FeedsV20 = self.execute(sql) 35 for row in FeedsV20[2:]: 36 (FeedId, CreateTime, FaultId, Type, UserName, Status, ExtFlag, PrivFlag, StringId, Content) = row 37 38 Content = xml2dict(Content) if Content and Content.startswith("<") else Content 39 CreateTime = timestamp2str(CreateTime) 40 print( 41 f"{FeedId=}\n" 42 f"{CreateTime=}\n" 43 f"{FaultId=}\n" 44 f"{Type=}\n" 45 f"{UserName=}\n" 46 f"{Status=}\n" 47 f"{ExtFlag=}\n" 48 f"{PrivFlag=}\n" 49 f"{StringId=}\n\n" 50 f"{json.dumps(Content, indent=4, ensure_ascii=False)}\n\n" 51 ) 52 return FeedId, CreateTime, FaultId, Type, UserName, Status, ExtFlag, PrivFlag, StringId, Content 53 54 def get_sns_comment(self): 55 pass