Aragur/yowsup

The keys are not updated correctly

Jeronimo17 opened this issue · 30 comments

I went from windows to linux and forgot to copy the key database; I can update the key when I speak privately with someone, the keys are not updated from the group

I use https://github.com/hoehermann/wxpyWha

Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type text
Writing 194 messages...
WARNING:yowsup.layers.axolotl.layer_receive:InvalidMessage or InvalidKeyIdException for xxxxxxx5923, going to send a retry
Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type text
Writing 195 messages...
Received a receipt with ID xxxxxxx020-22, sending ack.
Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type text
Writing 196 messages...
WARNING:yowsup.layers.axolotl.layer_receive:InvalidMessage or InvalidKeyIdException for xxxxxxx5923, going to send a retry
Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type text
Writing 197 messages...
WARNING:yowsup.layers.axolotl.layer_receive:InvalidMessage or InvalidKeyIdException for xxxxxxx9296, going to send a retry
WARNING:axolotl.sessionbuilder:We've already setup a session for this V3 message, letting bundled message fall through...
Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type text
Writing 198 messages...
WARNING:yowsup.layers.axolotl.layer_receive:InvalidMessage or InvalidKeyIdException for xxxxxxx5923, going to send a retry
Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type text
Writing 199 messages...
Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type text
Writing 200 messages...
Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type text
Writing 201 messages...
Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type text
Writing 202 messages...
Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type text
Writing 203 messages...
Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type text
Writing 204 messages...
WARNING:yowsup.layers.axolotl.layer_receive:InvalidMessage or InvalidKeyIdException for xxxxxxx5923, going to send a retry
Received a message from xxxxxxxxxxx-xxxxxxxxxx@g.us of type media
Writing 205 messages...

Thank you

So keys should update after a message which cant be decrypted is recieved.
Could you please check this?

I do not understand what you want to say to me, I think that when you speak privately with someone who does not have the right key, it is updated well but when in the group someone you have not talked to before speaks, the key is not updated at least that you speak in private with him, then already if the messages arrive by the group of that person

Okay
They should definitly update, and I can not reproduce that.
We are experiencing currently encryption problems in groups maybe that could be your cause.
If you need any advice please jump on our discord, so we can trace and fix the issue.

Yowsup Cli client
==================
Type /help for available commands

[offline]:/L
Auth: Logged in!
[connected]:WARNING:yowsup.layers.axolotl.layer_receive:InvalidMessage or InvalidKeyIdException for xxxxxxxx955, going to send a retry
INFO:yowsup.layers.axolotl.layer_receive:Trying GetKeys for xxxxxxxx955, getting keys now
WARNING:yowsup.layers.axolotl.layer_receive:InvalidMessage or InvalidKeyIdException for xxxxxxxx955, going to send a retry
INFO:yowsup.layers.axolotl.layer_receive:Trying GetKeys for xxxxxxxx955, getting keys now
WARNING:yowsup.layers.axolotl.layer_receive:InvalidMessage or InvalidKeyIdException for xxxxxxxx955, going to send a retry
INFO:yowsup.layers.axolotl.layer_receive:Trying GetKeys for xxxxxxxx955, getting keys now
WARNING:yowsup.layers.axolotl.layer_receive:InvalidMessage or InvalidKeyIdException for xxxxxxxx955, going to send a retry
INFO:yowsup.layers.axolotl.layer_receive:Trying GetKeys for xxxxxxxx955, getting keys now

This error comes out every time I log in now
I can not avoid this error, I do not get more messages from no one

@Jeronimo17 Do you found a fix for that ? I'm receiving the same behavior

@Jeronimo17 @juanpmarin
Same issue happening on my side.
I have no idea how to fix this.
It seems that retry messages are not coming through.

@AragurDEV so the issue is on the client or on the whatsapp backend ?

Both :P
WhatsApp may have changed something on the Backend, so yowsup can't respond to that

@AragurDEV :(
Do you know where can we start to search ?

Only with reverse engineering or packet sniffing I think.

Hi @AragurDEV, how can I help on the research ? How can I sniff the packets ?

The same is said in the original tgalal#2516
Apparently the problem is just receiving not sending

@juanpmarin You can use a Proxy and than sniff with Wireshark (also you have to send a "fake" SLL cert to the client to decrypt these properly)

@Jeronimo17 Yes it is only the recieving part (in groups) also this PR doesn't fix anything^^

@aero9 - you should open a new issue or use the discord chat, your issue has nothing to do with this issue #79 and distracts everyone from the original problem.

@AragurDEV in our case the problem with group is affecting the whole bot, so we cannot receive any massage in the group or one on one messages between contacts... any idea how to back to normal?

@gauchoarg No idea. Sorry. Maybe a account deletion -> reregistration could help.

Today, I have tried again and with the errors, I have received messages from the groups of 5 days ago, more recent do not arrive: S

j-gkr commented

hey guys, i have the same issue. Will there be a fix for this problem? I would really appreciate it because i am struggling with this issue some weeks now. or does anybody has some news to this?

I have not been connected for a long time waiting for a solution

The exception code is this
`

    except (InvalidMessageException, InvalidKeyIdException) as e
        logger.warning("InvalidMessage or KeyId for %s, going to send a retry", encMessageProtocolEntity.getAuthor(False))
        
        from yowsup.layers.axolotl.protocolentities.iq_key_get import GetKeysIqProtocolEntity
        entity = GetKeysIqProtocolEntity([encMessageProtocolEntity.getAuthor(False)])
        retry = RetryOutgoingReceiptProtocolEntity.fromMessageNode(node, self.store.getLocalRegistrationId())
        self.toLower(retry.toProtocolTreeNode())`

but the GetKeysIqProtocolEntity its never sended, why?

@franquitt I saw the same issue and I tried to send it with different ways but the keys were never retreived anyway

I get in my chat "XXX security code changed. Tap for more info.". When I tap I should verify the security codes by scanning QR-code. Deleting axolotl.db brings up the message again.....

@franquitt @juanpmarin
Indeed that is what I found. RetryOutgoingReceiptProtocolEntity is never received, WhatsApp may has changed some backend api endpoints...

jegue commented

no work around about this at this point?
this is an annoying erro!

j-gkr commented

i don't know...

can we do anything to get this work again?

jegue commented

so there is a way of passing the keys direct to the code on the class GetKeysIqProtocolEntity?
get the code from wahtassp App like a qr code reader.
and how? thanks

i got this reading the code

Raw text ���- !��>� �����^����!T矁NU*Yp� �4!����55984152�- !�,� P���r-��(`qс�(՘��T.W���n)/���55331058
Raw bytes 46 00 80 01 22 d0 a2 10 5f 33 ee 20 d1 1a 1e ea 8e 91 25 e8 2b f1 6c b2 15 4e 79 f8 14 e5 52 a5 97 0f 10 9a f3 42 1f 17 f1 20 83 53 53 93 83 43 13 53 21 a2 d0 a2 10 52 cb 80 d5 0a eb 68 f7 22 da 6e 52 86 07 1d 18 1f f2 8d 59 81 6e c5 42 e5 79 c8 21 56 e2 92 f1 81 20 83 53 53 33 33 13 03 53 80 ec 11 ec 11 ec 11 ec 11 ec 11
Barcode format QR_CODE
Parsed Result Type TEXT
Parsed Result ���- !��>� �����^����!T矁NU*Yp� �4!����55984152�- !�,� P���r-��(`qс�(՘��T.W���n)/���55331058

Some problem

Try this:

1 - rm -rf root/.yowsup .
2 - python -m compileall .
3- login

Re-Creating the keys as per @alejandroguille worked for me.