ppwwyyxx / wechat-dump

Cracking encrypted wechat message history from android
GNU General Public License v3.0
1.66k stars 307 forks source link

Data must be aligned to block boundary in ECB mode #72

Closed jackkingc closed 4 years ago

jackkingc commented 4 years ago

I first used EnMicroMsg.db-Password-Cracker this script to crack the password and used decrypt_db_with_password.pyto decrypt the EnMicroMsg.db ,and i found the corresponding file(avatar,image2,voice2,video,emoji) and put in resource file. I ran these two scripts successfully (dump-msg.py and list-chats.py). The some short chat history can be exported successfully。 when i run the dump-html.py the following error occurred (ValueError: Data must be aligned to block boundary in ECB mode)

python3 dump-html.py 刘伟 --res ./resource/ --output ./savechat/ --db output_db.db [16:27:23 78@parser.py:wechat.parser] Your username is: wxid_3l73nfylumon21 [16:27:23 52@parser.py:wechat.parser] Found 6199 names in contact table. [16:27:23 43@msg.py:wechat.msg] Unhandled message type: 285212721 [16:27:23 43@msg.py:wechat.msg] Unhandled message type: 452984881 [16:27:23 43@msg.py:wechat.msg] Unhandled message type: 587202609 [16:27:24 43@msg.py:wechat.msg] Unhandled message type: 570425393 [16:27:24 43@msg.py:wechat.msg] Unhandled message type: 318767153 [16:27:24 43@msg.py:wechat.msg] Unhandled message type: 10002 [16:27:24 43@msg.py:wechat.msg] Unhandled message type: 64 [16:27:24 43@msg.py:wechat.msg] Unhandled message type: 822083633 [16:27:25 43@msg.py:wechat.msg] Unhandled message type: 486539313 [16:27:25 43@msg.py:wechat.msg] Unhandled message type: 754974769 [16:27:26 43@msg.py:wechat.msg] Unhandled message type: 805306417 [16:27:26 43@msg.py:wechat.msg] Unhandled message type: 721420337 [16:27:26 43@msg.py:wechat.msg] Unhandled message type: 889192497 [16:27:27 43@msg.py:wechat.msg] Unhandled message type: 855638065 [16:27:27 72@parser.py:wechat.parser] Found 579698 message records. [16:27:27 84@parser.py:wechat.parser] Found 26698 hd image records. [16:27:28 43@dump-html.py:wechat] Number of Messages for chatid wxid_9939999399614: 55 [16:27:28 55@render.py:wechat.msg] Loading wx.css [16:27:28 55@render.py:wechat.msg] Loading jquery.fancybox.css [16:27:28 64@render.py:wechat.msg] Loading jquery-latest.min.js [16:27:28 64@render.py:wechat.msg] Loading jquery.fancybox.js [16:27:28 64@render.py:wechat.msg] Loading main.js [16:27:28 221@render.py:wechat.msg] Rendering 55 messages of 刘伟 Traceback (most recent call last): File "dump-html.py", line 47, in htmls = render.render_msgs(msgs) File "/home/karl/wechatproject/wechat-dump/wechat/render.py", line 225, in render_msgs ret = [self._render_partial_msgs(s) for s in slice_by_size] File "/home/karl/wechatproject/wechat-dump/wechat/render.py", line 225, in ret = [self._render_partial_msgs(s) for s in slice_by_size] File "/home/karl/wechatproject/wechat-dump/wechat/render.py", line 189, in _render_partial_msgs blocks.extend([self.render_msg(m) for m in slice]) File "/home/karl/wechatproject/wechat-dump/wechat/render.py", line 189, in blocks.extend([self.render_msg(m) for m in slice]) File "/home/karl/wechatproject/wechat-dump/wechat/render.py", line 141, in render_msg emoji_img, format = self.res.get_emoji_by_md5(md5) File "/home/karl/wechatproject/wechat-dump/wechat/res.py", line 159, in get_emoji_by_md5 return self.emoji_reader.get_emoji(md5) File "/home/karl/wechatproject/wechat-dump/wechat/emoji.py", line 75, in get_emoji img, format = self._search_in_res(dir_to_search, md5, False) File "/home/karl/wechatproject/wechat-dump/wechat/emoji.py", line 150, in _search_in_res results = [(x, get_data_func(x)) for x in candidates] File "/home/karl/wechatproject/wechat-dump/wechat/emoji.py", line 150, in results = [(x, get_data_func(x)) for x in candidates] File "/home/karl/wechatproject/wechat-dump/wechat/emoji.py", line 132, in get_data_no_fallback content = self._decrypt_emoji(fname) File "/home/karl/wechatproject/wechat-dump/wechat/emoji.py", line 161, in _decrypt_emoji plain_head = cipher.decrypt(head) File "/usr/local/lib/python3.7/dist-packages/Crypto/Cipher/_mode_ecb.py", line 195, in decrypt raise ValueError("Data must be aligned to block boundary in ECB mode") ValueError: Data must be aligned to block boundary in ECB mode

ppwwyyxx commented 4 years ago

The latest commit will skip this error. Could you give it a try?

jackkingc commented 4 years ago

No errors were reported, and the contentwas successfully exported.thank you!!