WhatsApp如何从keystore.xml提取哈希

发布于 2025-01-26 00:32:19 字数 1029 浏览 1 评论 0原文

<?xml version="1.0" encoding="UTF-8" standalone="true"?>

-<map>

<string name="server_static_public">qJWvSttNopqgQ2CgXYTc4jmSUKWd1Rv2QTMbQyYpKwY</string>

<string name="client_static_keypair_enc">[0,"s62vHltkeT3lP9cJD4fYiXlqMpnfCy\/lpQ5DXkPDgDvE0FzdBK\/52kQIJ\/cHAE+cx\/YynQFb\/V2OAKTWaKbhbUTVF7AtYc7ObiYi1NDicOM","Iy5pL5mCD5my9Ce4"]</string>

<long name="client_static_keypair_enc_success" value="6"/>

<boolean name="can_user_android_key_store" value="true"/>

<string name="client_static_keypair_pwd_enc">[2,"Zeu0mZ\/1KHNRPlSD3NCAyqXk+0Jy9BQzqnOOSGpDaZk1iq\/2g+ZQRpZpVBTdgY1GAIl+LAmZuzGQrc3Wg8jGKw","c16SyxGwPgcSscZu7Aq0hg","0YXK+g","3x7RocV+jSfcYyNwg8gxwQ"]</string>

</map>

如何将client_static_keypair_pwd_enc中的数据转换为正确的数据? 正确的数据是: KEY1:P2U4BDU15UU2PGPS5ZC6/IPPJTDE5KNQXEDNPUNROIG = KEY2:0JSAVVC6LG6N05FQOYHXO6Q2ONEBLJ4UMPG88RO4YEE =

兄弟,您能帮我吗?非常感谢

<?xml version="1.0" encoding="UTF-8" standalone="true"?>

-<map>

<string name="server_static_public">qJWvSttNopqgQ2CgXYTc4jmSUKWd1Rv2QTMbQyYpKwY</string>

<string name="client_static_keypair_enc">[0,"s62vHltkeT3lP9cJD4fYiXlqMpnfCy\/lpQ5DXkPDgDvE0FzdBK\/52kQIJ\/cHAE+cx\/YynQFb\/V2OAKTWaKbhbUTVF7AtYc7ObiYi1NDicOM","Iy5pL5mCD5my9Ce4"]</string>

<long name="client_static_keypair_enc_success" value="6"/>

<boolean name="can_user_android_key_store" value="true"/>

<string name="client_static_keypair_pwd_enc">[2,"Zeu0mZ\/1KHNRPlSD3NCAyqXk+0Jy9BQzqnOOSGpDaZk1iq\/2g+ZQRpZpVBTdgY1GAIl+LAmZuzGQrc3Wg8jGKw","c16SyxGwPgcSscZu7Aq0hg","0YXK+g","3x7RocV+jSfcYyNwg8gxwQ"]</string>

</map>

How to convert the data in client_static_keypair_pwd_enc into correct data?
The correct data is:
key1:P2u4BDU15Uu2pGpS5zC6/IPpjTDE5KnQxeDNpunroig=
key2:0JsAvVC6lG6n05fQOYHXO6Q2ONebLJ4UMPg88rO4yEE=

Brother, can you help me? thank you very much

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

离鸿 2025-02-02 00:32:19

看起来像BeautifureSoup4这样的工作模块可以帮助您。它可以通过在您的终端或CMD中运行PIP安装来安装,并且可以在 https://www.crummy.com/software/beautifersoup/bs4/doc/

Looks like a job modules like BeautifulSoup4 could help you with. It can be installed by running pip install beautifulsoup4 in your terminal or cmd and the documentation can be found at https://www.crummy.com/software/BeautifulSoup/bs4/doc/.

躲猫猫 2025-02-02 00:32:19

您可以看到这个:
https://github.com/tgalal/yowsup/yowsup/discuspions/3056

import json
import base64
from hashlib import pbkdf2_hmac
from Crypto.Cipher import AES

TOKEN_RAW = [
    0x41, 0x04, 0x1d, 0x40, 0x11, 0x18, 0x56, 0x91, 0x02, 0x90,
    0x88, 0x9f, 0x9e, 0x54, 0x28, 0x33, 0x7b, 0x3b, 0x45, 0x53
]
TOKEN = bytes(map(lambda x: x ^ 0x12, TOKEN_RAW))


def base64_decode(text):
    return base64.b64decode(text + '==')


def decrypt(password, iv, salt, ciphertext):
    password_ = TOKEN + password
    password_ = ''.join(map(chr, password_)).encode()  # b'\x83' => b'\xc2\x83'
    key = pbkdf2_hmac('sha1', password_, salt, 16, 16)
    return AES.new(key, AES.MODE_OFB, iv).decrypt(ciphertext)


def decrypt_keypair(keypair_pwd_enc):
    json_text = keypair_pwd_enc.replace('"', '"').replace('\/', '/')
    json_data = json.loads(json_text)
    version, ciphertext, iv, salt, password = json_data

    assert version == 2
    ciphertext = base64_decode(ciphertext)
    iv = base64_decode(iv)
    salt = base64_decode(salt)
    password = password.encode()

    result = decrypt(password, iv, salt, ciphertext)
    return base64.b64encode(result).decode()


def test():
    client_static_keypair_pwd_enc = '[2,"Leol3AoKXTUQxihhB0hUNgWueQo0E59PuYTxs9WJPktis56ZcRb2ZPXI9rOzKmXCaNO+wNIcGWsitAo\/Ijum0w","2P2WJHXo7uFHGh3k7uUaDQ","HFYgAg","m3Uq1DOgWw6FhKSMgUgJnQ"]'
    result = decrypt_keypair(client_static_keypair_pwd_enc)
    print('client_static_keypair:\n' + result)


if __name__ == '__main__':
    test()

you can see this:
https://github.com/tgalal/yowsup/discussions/3056

import json
import base64
from hashlib import pbkdf2_hmac
from Crypto.Cipher import AES

TOKEN_RAW = [
    0x41, 0x04, 0x1d, 0x40, 0x11, 0x18, 0x56, 0x91, 0x02, 0x90,
    0x88, 0x9f, 0x9e, 0x54, 0x28, 0x33, 0x7b, 0x3b, 0x45, 0x53
]
TOKEN = bytes(map(lambda x: x ^ 0x12, TOKEN_RAW))


def base64_decode(text):
    return base64.b64decode(text + '==')


def decrypt(password, iv, salt, ciphertext):
    password_ = TOKEN + password
    password_ = ''.join(map(chr, password_)).encode()  # b'\x83' => b'\xc2\x83'
    key = pbkdf2_hmac('sha1', password_, salt, 16, 16)
    return AES.new(key, AES.MODE_OFB, iv).decrypt(ciphertext)


def decrypt_keypair(keypair_pwd_enc):
    json_text = keypair_pwd_enc.replace('"', '"').replace('\/', '/')
    json_data = json.loads(json_text)
    version, ciphertext, iv, salt, password = json_data

    assert version == 2
    ciphertext = base64_decode(ciphertext)
    iv = base64_decode(iv)
    salt = base64_decode(salt)
    password = password.encode()

    result = decrypt(password, iv, salt, ciphertext)
    return base64.b64encode(result).decode()


def test():
    client_static_keypair_pwd_enc = '[2,"Leol3AoKXTUQxihhB0hUNgWueQo0E59PuYTxs9WJPktis56ZcRb2ZPXI9rOzKmXCaNO+wNIcGWsitAo\/Ijum0w","2P2WJHXo7uFHGh3k7uUaDQ","HFYgAg","m3Uq1DOgWw6FhKSMgUgJnQ"]'
    result = decrypt_keypair(client_static_keypair_pwd_enc)
    print('client_static_keypair:\n' + result)


if __name__ == '__main__':
    test()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文