This commit is contained in:
Yuxin Wu
2025-01-05 17:03:38 +08:00
parent cb76a41edc
commit 20708ef755
6 changed files with 27 additions and 5 deletions
+2 -1
View File
@@ -6,7 +6,8 @@ PROG_DIR=`dirname "$PROG_NAME"`
cd "$PROG_DIR"
# Please check that your path is the same, since this might be different among devices
RES_DIR="/mnt/sdcard/tencent/MicroMsg"
# RES_DIR="/mnt/sdcard/tencent/MicroMsg" # old version of wechat use this path.
RES_DIR="/data/data/com.tencent.mm"
MM_DIR="/data/data/com.tencent.mm"
echo "Starting rooted adb server..."
+1 -1
View File
@@ -47,7 +47,7 @@ ifeq (yes,$(USE_NEON))
endif
CFLAGS += -Wall -enable-threads -O3
CFLAGS += -Wall -O3
CFLAGS += $(call cppflags-from-defines,$(CDEFINES))
CFLAGS += $(call cppflags-from-defines,$(ADDED_DEFINES))
+5
View File
@@ -54,6 +54,11 @@ class AvatarReader(object):
candidates = glob.glob(os.path.join(self.avt_dir, dir1, dir2, f"*{avtid}*"))
candidates = sorted(set(candidates), key=_filename_priority, reverse=True)
for cand in candidates:
if os.path.isdir(cand):
candidates.extend(os.path.join(cand, x) for x in os.listdir(cand))
for cand in candidates:
if os.path.isdir(cand):
continue
try:
if cand.endswith(".bm"):
return self.read_bm_file(cand)
+6
View File
@@ -14,6 +14,7 @@ TYPE_CUSTOM_EMOJI = 1048625
TYPE_REDENVELOPE = 436207665
TYPE_MONEY_TRANSFER = 419430449 # 微信转账
TYPE_LOCATION_SHARING = -1879048186
TYPE_REPLY = 822083633 # 回复的消息.
TYPE_APP_MSG = 16777265
_KNOWN_TYPES = [eval(k) for k in dir() if k.startswith('TYPE_')]
@@ -110,6 +111,11 @@ class WeChatMsg(object):
except:
pass
return "[Money Transfer]"
elif self.type == TYPE_REPLY:
pq = PyQuery(self.content_xml_ready)
msg = pq('title').text()
# TODO parse reply.
return msg
else:
# TODO replace smiley with text
return self.content
+4 -1
View File
@@ -74,7 +74,10 @@ SELECT {} FROM message
def _parse_userinfo(self):
userinfo_q = self.cc.execute(""" SELECT id, value FROM userinfo """)
userinfo = dict(userinfo_q)
self.username = userinfo[2]
self.username = userinfo.get(2, None)
if self.username is None:
logger.error("Cannot find username in userinfo table!")
self.username = input("Please enter your username:")
logger.info("Your username is: {}".format(self.username))
def _parse_imginfo(self):
+7
View File
@@ -148,10 +148,17 @@ class Resource(object):
return None
if not img_file.endswith('jpg') and \
imghdr.what(img_file) != 'jpeg':
try:
im = Image.open(open(img_file, 'rb'))
except:
return None
buf = io.BytesIO()
im.convert('RGB').save(buf, 'JPEG', quality=JPEG_QUALITY)
return base64.b64encode(buf.getvalue()).decode('ascii')
with open(img_file, 'rb') as f:
if f.read(4) == b'wxgf':
logger.warning(f"Don't know how to decode wxgf image {img_file}")
return None
return get_file_b64(img_file)
big_file = get_jpg_b64(big_file)