{"id":1827,"date":"2023-05-06T10:14:29","date_gmt":"2023-05-06T02:14:29","guid":{"rendered":"https:\/\/eotstxtab.top\/?p=1827"},"modified":"2023-05-06T10:15:02","modified_gmt":"2023-05-06T02:15:02","slug":"wechat%e8%81%8a%e5%a4%a9%e8%ae%b0%e5%bd%95db%e5%8f%96%e8%af%81%e8%a7%a3%e5%af%86","status":"publish","type":"post","link":"http:\/\/43.142.23.155\/?p=1827","title":{"rendered":"Wechat\u804a\u5929\u8bb0\u5f55db\u53d6\u8bc1\u89e3\u5bc6"},"content":{"rendered":"\n<p>\u5df2\u52a0\u5bc6\u6570\u636e\u5e93\u8def\u5f84\uff1a\u2026\\WeChat Files\\wxid_44cdgh0tng3o41\\Msg\\Multi<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. \u601d\u8def<\/h2>\n\n\n\n<p>MSGx.db\u6587\u4ef6\u4e00\u822c\u7528AES\u768464\u4f4d\u5bc6\u94a5\u52a0\u5bc6\uff0c\u5fae\u4fe1\u5728\u8fd0\u884c\u65f6\u4f1a\u5c06\u8be5aeskey\u653e\u5728\u5185\u5b58\u91cc\uff0c\u56e0\u6b64\u6211\u4eec\u53ea\u8981\u77e5\u9053aeskey\u5230\u57fa\u5730\u5740\u7684\u504f\u79fb\u8ddd\u79bb+\u57fa\u5730\u5740\u5f97\u5230\u5bc6\u94a5\u5730\u5740\uff0c\u4ece\u800c\u8bfb\u53d6\u5e76\u89e3\u7801\uff0c\u7528\u4e8e\u7834\u89e3\u8be5\u6570\u636e\u5e93\uff0c\u6700\u7ec8\u7528\u6570\u636e\u5e93\u8f6f\u4ef6\u6253\u5f00\u5c31\u597d\u3002<\/p>\n\n\n\n<p><strong>GetKey.py<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#! \/usr\/bin\/env python3\n# -*- coding: utf-8 -*-\n\nimport pymem\nimport struct\nimport binascii\n\nAESKEY_OFFSET = 0x2FFD590\nWECHAT_VERSION = \"3.9.2.23\"\n\ndef getAesKey(p):\n    # \u83b7\u53d6 WeChatWin.dll \u7684\u57fa\u5730\u5740\n    base_address = pymem.process.module_from_name(p.process_handle, \"wechatwin.dll\").lpBaseOfDll\n\n    # \u8bfb\u53d6 AES Key \u7684\u5730\u5740\n    result = p.read_bytes(base_address + AESKEY_OFFSET, 4)\n    addr = struct.unpack(\"&lt;I\", result)&#91;0]\n\n    # \u8bfb\u53d6 AES Key\n    aesKey = p.read_bytes(addr, 0x20)\n\n    # \u89e3\u7801\n    result = binascii.b2a_hex(aesKey)\n    return base_address, result.decode()\n\nif __name__ == \"__main__\":\n    print(f\"\u5fae\u4fe1\u7248\u672c\u4e3a\uff1a{WECHAT_VERSION}\\n\u5bc6\u94a5\u504f\u79fb\u5730\u5740\u4e3a\uff1a{hex(AESKEY_OFFSET)}\")\n    p = pymem.Pymem()\n    p.open_process_from_name(\"WeChat.exe\")\n    base_offset, aesKey = getAesKey(p)\n    print(f\"\u6570\u636e\u5e93\u5bc6\u94a5\u4e3a\uff1a{aesKey}\"<\/code><\/pre>\n\n\n\n<p><strong>DecDB.py<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#! \/usr\/bin\/env python3\n# -*- coding: utf-8 -*-\n\nimport hmac\nimport ctypes\nimport hashlib\nfrom Crypto.Cipher import AES\n\ndef decrypt_msg(path, password):\n    KEY_SIZE = 32\n    DEFAULT_ITER = 64000\n    DEFAULT_PAGESIZE = 4096  # 4048\u6570\u636e + 16IV + 20 HMAC + 12\n    SQLITE_FILE_HEADER = bytes(\"SQLite format 3\", encoding=\"ASCII\") + bytes(1)  # SQLite \u6587\u4ef6\u5934\n\n    with open(path, \"rb\") as f:\n        # TODO: \u4f18\u5316\uff0c\u8003\u8651\u8d85\u5927\u6587\u4ef6\n        blist = f.read()\n\n    salt = blist&#91;:16]  # \u524d16\u5b57\u8282\u4e3a\u76d0\n    key = hashlib.pbkdf2_hmac(\"sha1\", password, salt, DEFAULT_ITER, KEY_SIZE)  # \u83b7\u5f97Key\n\n    page1 = blist&#91;16:DEFAULT_PAGESIZE]  # \u4e22\u6389salt\n\n    mac_salt = bytes(&#91;x ^ 0x3a for x in salt])\n    mac_key = hashlib.pbkdf2_hmac(\"sha1\", key, mac_salt, 2, KEY_SIZE)\n\n    hash_mac = hmac.new(mac_key, digestmod=\"sha1\")\n    hash_mac.update(page1&#91;:-32])\n    hash_mac.update(bytes(ctypes.c_int(1)))\n\n    if hash_mac.digest() != page1&#91;-32:-12]:\n        raise RuntimeError(\"Wrong Password\")\n\n    pages = &#91;blist&#91;i:i+DEFAULT_PAGESIZE] for i in range(DEFAULT_PAGESIZE, len(blist), DEFAULT_PAGESIZE)]\n    pages.insert(0, page1)  # \u628a\u7b2c\u4e00\u9875\u8865\u4e0a\n\n    with open(f\"{path}.dec.db\", \"wb\") as f:\n        f.write(SQLITE_FILE_HEADER)  # \u5199\u5165\u6587\u4ef6\u5934\n\n        for i in pages:\n            t = AES.new(key, AES.MODE_CBC, i&#91;-48:-32])\n            f.write(t.decrypt(i&#91;:-48]))\n            f.write(i&#91;-48:])\n\nif __name__ == \"__main__\":\n    path = \"E:\/wechat\/documents\/WeChat Files\/wxid_44cdgh0tng3o41\/Msg\/Multi\/MSG0.db\"\n    key = bytes.fromhex(\"cannot tell u \") # \n\n    decrypt_msg(path, key)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">2. \u5c1d\u8bd5\u83b7\u53d6\u65b0\u7248\u672c3.9.2.23\u7684\u504f\u79fb\u5730\u5740<\/h2>\n\n\n\n<p>\u8bd5\u4e86\u597d\u51e0\u4e2a\u65b9\u6cd5\u548c\u5de5\u5177\u4f46\u662f\u4e0d\u77e5\u9053\u8be5\u641c\u7d22\u4ec0\u4e48\u5173\u952e\u8bcd\u2026<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"676\" height=\"511\" src=\"https:\/\/eotstxtab.top\/wp-content\/uploads\/2023\/05\/image.png\" alt=\"\" class=\"wp-image-1830\" srcset=\"http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image.png 676w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-300x227.png 300w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-670x506.png 670w\" sizes=\"auto, (max-width: 676px) 100vw, 676px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"639\" height=\"640\" src=\"https:\/\/eotstxtab.top\/wp-content\/uploads\/2023\/05\/image-1.png\" alt=\"\" class=\"wp-image-1831\" srcset=\"http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-1.png 639w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-1-300x300.png 300w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-1-150x150.png 150w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-1-200x200.png 200w\" sizes=\"auto, (max-width: 639px) 100vw, 639px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">2. \u6700\u7ec8\u5b9e\u73b0\u6548\u679c<\/h2>\n\n\n\n<p>\u8fd9\u91cc\u5176\u5b9e\u662fhttps:\/\/github.com\/AdminTest0\/SharpWxDump\u8fd9\u4e2a\u9879\u76ee\u91cc\u7684\u6e90\u7801\uff0c\u91cc\u9762\u6709\u5199\u52303.9\u7248\u672c\u7684\u504f\u79fb\u5730\u5740\uff0c\u4e0d\u8fc7\u4ed6\u4f7f\u7528int\u7684\u5341\u8fdb\u5236\uff0c\u6211\u4eec\u7528\u8ba1\u7b97\u5668\u7b97\u4e00\u4e0b\u6539\u4e3a0x\u2026\u2026\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n\n\n\n<p>\u8fd9\u91cc\u6709\u4e24\u4e2a\u53ef\u80fd\u7684\u5bc6\u94a5\uff0c\u6bcf\u4e2a\u90fd\u8bd5\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"844\" height=\"671\" src=\"https:\/\/eotstxtab.top\/wp-content\/uploads\/2023\/05\/image-3.png\" alt=\"\" class=\"wp-image-1833\" srcset=\"http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-3.png 844w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-3-300x239.png 300w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-3-768x611.png 768w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-3-670x533.png 670w\" sizes=\"auto, (max-width: 844px) 100vw, 844px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"572\" height=\"176\" src=\"https:\/\/eotstxtab.top\/wp-content\/uploads\/2023\/05\/image-4.png\" alt=\"\" class=\"wp-image-1834\" srcset=\"http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-4.png 572w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-4-300x92.png 300w\" sizes=\"auto, (max-width: 572px) 100vw, 572px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"774\" height=\"264\" src=\"https:\/\/eotstxtab.top\/wp-content\/uploads\/2023\/05\/image-5.png\" alt=\"\" class=\"wp-image-1835\" srcset=\"http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-5.png 774w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-5-300x102.png 300w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-5-768x262.png 768w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-5-670x229.png 670w\" sizes=\"auto, (max-width: 774px) 100vw, 774px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u5176\u4ed6<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"791\" height=\"128\" src=\"https:\/\/eotstxtab.top\/wp-content\/uploads\/2023\/05\/image-2.png\" alt=\"\" class=\"wp-image-1832\" srcset=\"http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-2.png 791w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-2-300x49.png 300w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-2-768x124.png 768w, http:\/\/43.142.23.155\/wp-content\/uploads\/2023\/05\/image-2-670x108.png 670w\" sizes=\"auto, (max-width: 791px) 100vw, 791px\" \/><\/figure>\n\n\n\n<p>\u771f\u65e0\u8bed\uff0c\u7edf\u4e00\u7248\u672c\u4e0d\u540c\u8bbe\u5907\u4e0b\u7684\u5bc6\u94a5\u662f\u4e0d\u540c\u7684\uff0c\u8fd9\u5c31\u610f\u5473\u7740\u5982\u679c\u5728\u7535\u8111\u4e0a\u6709\u4e2a\u73cd\u8d35\u7684\u804a\u5929\u8bb0\u5f55\u6570\u636e\uff0c\u6709\u4e00\u5929\u8fd9\u4e2a\u7535\u8111\u91cc\u7684\u5fae\u4fe1\u5d29\u6e83\u4e0d\u80fd\u8fd0\u884c\u4e86\uff0c\u8fd9\u4e2a\u8bb0\u5f55\u4e5f\u6062\u590d\u4e0d\u51fa\u6765\u2026\u56e0\u4e3a\u76ee\u524d\u6765\u8bf4\u9664\u975e\u83b7\u5f97AES\u7684\u52a0\u5bc6\u65b9\u5f0f\uff08\u5bc6\u94a5\u548c\u660e\u6587m\uff09\uff0c\u5426\u5219\u5c31\u53ea\u80fd\u5728\u5fae\u4fe1\u8fd0\u884c\u7684\u65f6\u5019\u5728\u5185\u5b58\u91cc\u8bfb\u53d6key\uff0c\u5f53\u7136\u4e86\u80fd\u9006\u5411\u51fa\u6765\u8fd9\u4e2a\u52a0\u5bc6\u7b97\u6cd5\u662f\u6700\u597d\u7684\uff0c\u4f46\u662f\u4e5f\u4e0d\u592a\u73b0\u5b9e\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Reference:<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/4DbXOS5jDjJzM2PN0Mp2JA\">\u7ea2\u961f\u653b\u9632\u4e4bPC\u7aef\u5fae\u4fe1\u4e2a\u4eba\u4fe1\u606f\u4e0e\u804a\u5929\u8bb0\u5f55\u53d6\u8bc1 (qq.com)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mp.weixin.qq.com\/s\/nckZTQ0leQLz27vUv4KfGg\">\u5077\u5077\u67e5\u770b\u5fae\u4fe1\u804a\u5929\u8bb0\u5f55 (qq.com)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/blog.csdn.net\/Crazy_zh\/article\/details\/127162654#:~:text=PC%E5%AE%A2%E6%88%B7%E7%AB%AF%201%20%E6%9F%A5%E6%89%BE%E6%95%B0%E6%8D%AE%E5%BA%93%E6%96%87%E4%BB%B6%E4%BD%8D%E7%BD%AE%20%E5%9B%A0%E4%B8%BA%E5%AD%98%E5%82%A8%E4%BD%8D%E7%BD%AE%E4%B8%8D%E7%9B%B8%E5%90%8C%EF%BC%8C%E6%8E%A8%E8%8D%90%E7%9B%B4%E6%8E%A5%E4%BD%BF%E7%94%A8%20Everything%20%E6%90%9C%E7%B4%A2%20MicroMsg.db%20%E3%80%82,%E4%BB%8E%E7%BD%91%E4%B8%8A%E6%89%BE%E5%88%B0%E4%BA%86%E5%A4%A7%E4%BD%AC%E5%86%99%E7%9A%84WeChatGetKey%E5%92%8C%E6%95%B0%E6%8D%AE%E5%BA%93%E8%A7%A3%E5%AF%86%E5%B7%A5%E5%85%B7%EF%BC%8C%E7%99%BB%E5%BD%95%E5%BE%AE%E4%BF%A1%E5%90%8E%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80GetKey%E5%B7%A5%E5%85%B7%E5%B0%B1%E5%8F%AF%E4%BB%A5%E5%BE%97%E5%88%B0Key%2C%20%E7%84%B6%E5%90%8E%E4%BF%AE%E6%94%B9%E8%A7%A3%E5%AF%86%E5%B7%A5%E5%85%B7%E8%BF%90%E8%A1%8C%E5%B0%B1%E5%8F%AF%E4%BB%A5%E5%BE%97%E5%88%B0%E8%A7%A3%E5%AF%86%E5%90%8E%E7%9A%84%E6%95%B0%E6%8D%AE%E5%BA%93%E6%96%87%E4%BB%B6%E3%80%82%20%E6%89%80%E6%9C%89%E6%95%B0%E6%8D%AE%E5%BA%93%E5%AF%86%E7%A0%81%E9%83%BD%E4%B8%80%E6%A0%B7%E3%80%82%203%20%E6%89%93%E5%BC%80%E6%95%B0%E6%8D%AE%E5%BA%93%20PC%E5%AE%A2%E6%88%B7%E7%AB%AF%E6%95%B0%E6%8D%AE%E5%BA%93%E7%94%A8%E7%9A%84%E6%98%AFSQLite%EF%BC%8C%E7%9B%B4%E6%8E%A5%E4%BD%BF%E7%94%A8%E7%9B%B8%E5%85%B3%E5%B7%A5%E5%85%B7%EF%BC%88%E5%A6%82%20navicat%20%EF%BC%89%E6%89%93%E5%BC%80%E6%9F%A5%E7%9C%8B%E5%8D%B3%E5%8F%AF%E3%80%82\">\u5fae\u4fe1\u6570\u636e\u5e93\u89e3\u5bc6<em>wechatgetkey<\/em>\u6eba\u9633\u7684\u535a\u5ba2-CSDN\u535a\u5ba2<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/bbs.kanxue.com\/thread-251303.htm\">[\u539f\u521b]PC\u7248\u5fae\u4fe1\u6570\u636e\u5e93\u89e3\u5bc6\u8be6\u7ec6\u6559\u7a0b-\u8f6f\u4ef6\u9006\u5411-\u770b\u96ea\u8bba\u575b-\u5b89\u5168\u793e\u533a|\u5b89\u5168\u62db\u8058|bbs.pediy.com (kanxue.com)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/AdminTest0\/SharpWxDump\">https:\/\/github.com\/AdminTest0\/SharpWxDump<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u5df2\u52a0\u5bc6\u6570\u636e\u5e93\u8def\u5f84\uff1a\u2026\\WeChat Files\\wxid_44cdgh0tng3o41\\Msg\\Multi 1. \u601d\u8def MSGx.db\u6587\u4ef6\u4e00\u822c\u7528AES\u768464\u4f4d\u5bc6\u94a5\u52a0\u5bc6\uff0c\u5fae\u4fe1\u5728\u8fd0\u884c\u65f6\u4f1a\u5c06\u8be5aeskey\u653e&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[77],"class_list":["post-1827","post","type-post","status-publish","format-standard","hentry","category-9","tag-77"],"_links":{"self":[{"href":"http:\/\/43.142.23.155\/index.php?rest_route=\/wp\/v2\/posts\/1827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/43.142.23.155\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/43.142.23.155\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/43.142.23.155\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/43.142.23.155\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1827"}],"version-history":[{"count":3,"href":"http:\/\/43.142.23.155\/index.php?rest_route=\/wp\/v2\/posts\/1827\/revisions"}],"predecessor-version":[{"id":1836,"href":"http:\/\/43.142.23.155\/index.php?rest_route=\/wp\/v2\/posts\/1827\/revisions\/1836"}],"wp:attachment":[{"href":"http:\/\/43.142.23.155\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/43.142.23.155\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1827"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/43.142.23.155\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}