tgalal / yowsup

The WhatsApp lib
GNU General Public License v3.0
7.05k stars 2.23k forks source link

WhatsApp Keystore update #3042

Closed mahmoud-hassan-911 closed 3 years ago

mahmoud-hassan-911 commented 3 years ago

in the latest WhatsApp version, Keystore.xml file has changed and "client_static_keypair" changed to "client_static_keypair_pwd_enc" , it's a encrypted value for the old "client_static_keypair" used in login. the question is how to decrypt "client_static_keypair_pwd_enc" to get "client_static_keypair" so I can login with it ?

nightcoder22 commented 3 years ago

Sure thing. @lovethiscode. And you definitely deserve a star for your work. Can you mail me your working copy of yowsup? The one I had is deployed on the server and I had tweaked lots of thing in it.. I just need the scratch working copy. ( with pull requests )

lovethiscode commented 3 years ago

I didn't actually use Yowsup, I developed a set of WhatsApp tools on my own use Java. Also develop some Yowsup related tools. If you are interested, you can check out my git @nightcoder22

Whatsapp-Protocol commented 3 years ago

yowsup_config_tool.apk https://github.com/lovethiscode/Gorgeous-Whatsapp

this may help you. @vikram4y

Whatsapp-Protocol commented 3 years ago

Maybe you can ask him to help you develop software that supports C#.

ben221199 commented 3 years ago

Who, me? :D

lovethiscode commented 3 years ago

I am not good at C#, I know C, I can make a C interface, and then you encapsulate it as C# to use. Telegram :gorgeous008
@vikram4y

Hyrem commented 3 years ago

@Whomakes Follow the steps:

  • Find keystore.xml on your device.
  • Extract the value of client_static_keypair_pwd_enc. It should look something like this: [2,"sdfsdfgsdf","cxvxcvzxcv","wetytryerrewf","fghktyvbfndygg"] (a JSON array with 5 elements)
  • Create a JSONArray Java-object by loading in all the values in order. (In the example, the elements are replaced by <iv>, <ciphertext>, <salt> and <password>.
  • Create a EncryptedClientStaticKeypair Java-object from the JSONArray Java-object.
  • When you have this object, you can run the decrypt function on it. It will give you the client_static_keypair in bytes.

Hi @ ben221199 I am interested in this method, could you tell me what kind of AES to decrypt you are using? I am doing something similar in Python, my enc key pair looks like this [2,"value2","value3","value4","value5"] in your example iv=value2, cipher=value3, salt=value4, pass=value5 ??? what about the value 1, what is that? thanks

ben221199 commented 3 years ago

@Hyrem The kind of AES is AES-OFB with no padding, as seen in the source code. The 2 is some version. In the last versions of WhatsApp it is always 2 as far as I know.

Hyrem commented 3 years ago

@ben221199 thanks

hdcscy commented 3 years ago

Thanks for your patient answer, but I used your Java project and generated client_static_keypair, but the handshake prompt 401 failed. I don't know if it is caused by "sometoken"? @ben221199

ben221199 commented 3 years ago

How did you code look like?

hdcscy commented 3 years ago

How did you code look like?

I just generated a json file, successfully wrote the json object, and executed it according to your code intact, but it failed. :-(

xmpp is: Failure: <failure reason="401" location="frc"/>

json is: { "client_static_keypair": "Generated by EncryptedClientStaticKeypair", "edge_routing_info": "CAIIDQ==", "login": my_test_phone_number, "mcc": "460", "mnc": "003", "fdid": "b8b2f38a-3164-44af-948e-84a25229bd67", "lg": "en", "lc": "US", "rc": 0 }

Finally, I have repeatedly confirmed that client_static_keypair JSONArray is absolutely correct, and I did it according to the instructions written in your wiki.

ben221199 commented 3 years ago

Hmmm okay, that is really strange. Maybe you are still missing something, but I don't know what...

hdcscy commented 3 years ago

Hmmm okay, that is really strange. Maybe you are still missing something, but I don't know what...

Okay, really a pity, but thanks Mr.ben221199. Can you execute this java project normally? I wonder if I forgot some data :-(

lovethiscode commented 3 years ago

your sometoken is wrong。so handshake failed.

m4stersh4d0w commented 1 year ago

Hi @lovethiscode , do you still have the yowsup_config_tool.apk APK and could share it with me please?

houjianwen123 commented 1 year ago

HI @lovethiscode , I also want to get the yowsup_config_tool.apk but seem the github project is not found any more

huoxing007 commented 1 year ago

@m4stersh4d0w @houjianwen123

Do you still need this apk now? My friend has it.