Closed yniv closed 8 years ago
I have a similar but different issue I have two numbers, I am using the latest S40 env discussed here and have update the V2 fix, cleared axolotl.db (multiple times) etc...
Both lines connect but
The error in B debug log:
File "/usr/local/lib/python2.7/dist-packages/yowsup/layers/protocol_media/layer.py", line 40, in recvMessageStanza
if mediaNode.getAttributeValue("type") == "image":
AttributeError: 'NoneType' object has no attribute 'getAttributeValue'
It looks like it is no londer receiving messages
@yniv @eduardobento I've fixed Bad Mac!!! Edit file axolotl/protocolentities/receipt_outgoing_retry.py
@staticmethod
def fromProtocolTreeNode(node):
entity = OutgoingReceiptProtocolEntity.fromProtocolTreeNode(node)
entity.__class__ = RetryOutgoingReceiptProtocolEntity
retryNode = node.getChild("retry")
entity.setRetryData(retryNode["t"], "1", retryNode["count"], node.getChild("registration").data)
#entity.setRetryData(retryNode["t"], retryNode["v"], retryNode["count"], node.getChild("registration").data)
@staticmethod
def fromMesageNode(MessageNodeToBeRetried):
return RetryOutgoingReceiptProtocolEntity(
MessageNodeToBeRetried.getAttributeValue("id"),
MessageNodeToBeRetried.getAttributeValue("from"),
MessageNodeToBeRetried.getAttributeValue("t"),
"1"
# MessageNodeToBeRetried.getChild("enc").getAttributeValue("v")
@jlguardi can you adapt this fix to yowsup protocol and not only to the demo client? please...
@relima this is for yowsup protocol!! I've edited axolotl/protocolentities/receipt_outgoing_retry.py
@jlguardi thanks! it resolved the bad mac issues. but the images still crushes everything and after that some (2-3) regular text messages doesn't work
@jlguardi I try your modification, look the log:
ERROR:yowsup.layers.axolotl.layer:No valid sessionsBad Mac!
DEBUG:yowsup.layers.logger.layer:tx:
<receipt to="xxxxxxxxxxx@s.whatsapp.net" type="retry" id="C0DA272BA264DFA1B1">
<retry count="1" v="1" t="1458738513" id="C0DA272BA264DFA1B1">
</retry>
<registration>
ÓuUU
HEX:e0755555
</registration>
</receipt>
DEBUG:yowsup.layers.logger.layer:rx:
<ack type="retry" from="xxxxxxxxxx@s.whatsapp.net" class="receipt" id="C0DA272BA264DFA1B1">
</ack>
Here persists the problem... any ideias?
@yniv if you don't ack or send retry, whatsapp closes connection
@jlguardi your fix really helped to move things forward (thank you very much). However, I am now having the same issues as @eduardobento and @yniv - it seems some acks are not being properly sent and a disconnection happens after a short while.
We're continuing the "acks not sent" issue on #1387, if anyone's interested
Hi @jlguardi ,
In this enviroment:
Results (Just for analysis):
It seems that in iPhone enc version=1 and Android enc version=2.. This is my tests for now.
The problem here is that everyone is trying to fix things without knowing what is actually happening and which data is the best to test and run with.
By the way, don't use S40. And check my commits, all the work is already done, the only thing is to translate to python.
Regards
Will you make a branch /repo fork? Cause it's indeed wasting time if 100 people work on different places. Would like having a final yowsup ...is it possible to make a fork?
Thorsten Fröhlich Am 23.03.2016 18:50 schrieb "mgp25" notifications@github.com:
The problem here is that everyone is trying to fix things without knowing what is actually happening and which data is the best to test and run with.
By the way, don't use S40. And check my commits, all the work is already done, the only thing is to translate to python.
Regards
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/tgalal/yowsup/issues/1389#issuecomment-200464439
I've forked yowsup and merged all PR in https://github.com/jlguardi/yowsup on master branch.
Moreover, I was trying to adapt chatAPI for encrypted media but I get corrupted data (I can read just the url but xml is corrupted. Probably I've used incorrect session). It's too hard for me but I'll try again.
Thanks man! Will try and take your fork and let u know if everything works so far
Thorsten Fröhlich Am 24.03.2016 02:54 schrieb "jlguardi" notifications@github.com:
I've forked yowsup and merged all PR in https://github.com/jlguardi/yowsup on master branch.
Moreover, I was trying to adapt chatAPI for encrypted media but I get corrupted data (I can read just the url but xml is corrupted. Probably I've used incorrect session). It's too hard for me but I'll try again.
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/tgalal/yowsup/issues/1389#issuecomment-200612326
you didn't change the token.. but it works for u?
2016-03-24 5:51 GMT+01:00 Thorsten Fröhlich thundergreen@googlemail.com:
Thanks man! Will try and take your fork and let u know if everything works so far
Thorsten Fröhlich Am 24.03.2016 02:54 schrieb "jlguardi" notifications@github.com:
I've forked yowsup and merged all PR in https://github.com/jlguardi/yowsup on master branch.
Moreover, I was trying to adapt chatAPI for encrypted media but I get corrupted data (I can read just the url but xml is corrupted. Probably I've used incorrect session). It's too hard for me but I'll try again.
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/tgalal/yowsup/issues/1389#issuecomment-200612326
@jlguardi thats great! can you please just post a tweak so the code will not break when getting an image message? just ignore media messages for now
@jlguardi it still breaks after trying your new branch when receiving images and does not work on iphone6 .. even if we are not able to get images because they are encrypted it will be great - if it works on all platforms and more importantly the image does not break the code and is silently ignored .. do u knw what change needs to be done? can u help?
@yniv sorry posted similar stuff together, it will b great to just ignore them for now ..
I've just added to axolotl/layer.py
if protocolTreeNode.tag == "message" or protocolTreeNode.tag == "media":
And It crashes while decrypted data parsing.
I've edited too ython-axolotl/axolotl/sessionbuilder.py to avoid None return:
if sessionRecord.hasSessionState(message.getMessageVersion(), message.getBaseKey().serialize()):
logger.warn("We've already setup a session for this V3 message, letting bundled message fall through...")
logger.warn("Ignored")
# return None
But chatapi checks in old sessions to try to decrypt. Probably this is my fault.
@jlguardi great, thanks a lot! could you please commit your change to master, i can take from there and test it out ..
@pag16 @jlguardi small fix to ignore media messages
def recvMessageStanza(self, node):
if node.getAttributeValue("type") == "media":
mediaNode = node.getChild("media")
if mediaNode == None:
return None
if mediaNode.getAttributeValue("type") == "image":
entity = ImageDownloadableMediaMessageProtocolEntity.fromProtocolTreeNode(node)
self.toUpper(entity)
elif mediaNode.getAttributeValue("type") == "audio":
entity = AudioDownloadableMediaMessageProtocolEntity.fromProtocolTreeNode(node)
self.toUpper(entity)
elif mediaNode.getAttributeValue("type") == "video":
entity = VideoDownloadableMediaMessageProtocolEntity.fromProtocolTreeNode(node)
self.toUpper(entity)
elif mediaNode.getAttributeValue("type") == "location":
entity = LocationMediaMessageProtocolEntity.fromProtocolTreeNode(node)
self.toUpper(entity)
elif mediaNode.getAttributeValue("type") == "vcard":
entity = VCardMediaMessageProtocolEntity.fromProtocolTreeNode(node)
self.toUpper(entity)
maybe i need to send ack also?
File "/opt/transwhat/transwhat.py", line 95, in
asyncore.loop(timeout=1.0, count=10, use_poll = True)
File "/usr/lib/python2.7/asyncore.py", line 220, in loop
poll_fun(timeout, map)
File "/usr/lib/python2.7/asyncore.py", line 201, in poll2
readwrite(obj, flags)
File "/usr/lib/python2.7/asyncore.py", line 123, in readwrite
obj.handle_error()
File "/usr/lib/python2.7/asyncore.py", line 108, in readwrite
obj.handle_read_event()
File "/usr/lib/python2.7/asyncore.py", line 449, in handle_read_event
self.handle_read()
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/network/layer.py", line 86, in handle_read
self.receive(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/network/layer.py", line 94, in receive
self.toUpper(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/init.py", line 59, in toUpper
self.upper.receive(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/stanzaregulator/layer.py", line 28, in receive
self.processReceived()
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/stanzaregulator/layer.py", line 48, in processReceived
self.toUpper(oneMessageData)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init.py", line 59, in toUpper
self.upper.receive(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/auth/layer_crypt.py", line 63, in receive
self.toUpper(payload)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init.py", line 59, in toUpper
self.upper.receive(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/coder/layer.py", line 35, in receive
self.toUpper(node)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init.py", line 59, in toUpper
self.upper.receive(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/axolotl/layer.py", line 127, in receive
self.toUpper(protocolTreeNode)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init.py", line 59, in toUpper
self.upper.receive(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init.py", line 169, in receive
s.receive(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/init.py", line 105, in receive
recv(node)
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/auth/layer_authentication.py", line 90, in handleStreamError
raise AuthError("Unhandled stream:error node:\n%s" % node)
AuthError: Unhandled stream:error node:
stream:error
/stream:error
@thundergreen this happened after you applied my code?
After running your master branch, I got many of the "missing" messages, but it stops again at encrypted group msgs:
Traceback (most recent call last):
File "run/bonio_whatsapp.py", line 33, in <module>
stack.loop()
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/stacks/yowstack.py", line 195, in loop
asyncore.loop(*args, **kwargs)
File "/usr/lib/python2.7/asyncore.py", line 216, in loop
poll_fun(timeout, map)
File "/usr/lib/python2.7/asyncore.py", line 156, in poll
read(obj)
File "/usr/lib/python2.7/asyncore.py", line 87, in read
obj.handle_error()
File "/usr/lib/python2.7/asyncore.py", line 83, in read
obj.handle_read_event()
File "/usr/lib/python2.7/asyncore.py", line 449, in handle_read_event
self.handle_read()
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/network/layer.py", line 86, in handle_read
self.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/network/layer.py", line 94, in receive
self.toUpper(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/stanzaregulator/layer.py", line 28, in receive
self.processReceived()
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/stanzaregulator/layer.py", line 51, in processReceived
self.processReceived()
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/stanzaregulator/layer.py", line 48, in processReceived
self.toUpper(oneMessageData)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/auth/layer_crypt.py", line 63, in receive
self.toUpper(payload)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/coder/layer.py", line 35, in receive
self.toUpper(node)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/logger/layer.py", line 14, in receive
self.toUpper(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/axolotl/layer.py", line 118, in receive
self.onMessage(protocolTreeNode)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/axolotl/layer.py", line 140, in onMessage
self.handleEncMessage(protocolTreeNode)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/axolotl/layer.py", line 225, in handleEncMessage
self.handleWhisperMessage(node)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/axolotl/layer.py", line 271, in handleWhisperMessage
encMessageProtocolEntity = EncryptedMessageProtocolEntity.fromProtocolTreeNode(node)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/axolotl/protocolentities/message_encrypted.py", line 53, in fromProtocolTreeNode
encNode.data.encode('latin-1') if sys.version_info >= (3,0) else encNode.data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/axolotl/protocolentities/message_encrypted.py", line 24, in setEncProps
assert encType in "pkmsg", "msg"
AssertionError: msg
I've tried disabling Axolotl layer, but that doesn't help, it only changes the error for another:
Traceback (most recent call last):
File "run/bonio_whatsapp.py", line 33, in <module>
stack.loop()
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/stacks/yowstack.py", line 195, in loop
asyncore.loop(*args, **kwargs)
File "/usr/lib/python2.7/asyncore.py", line 216, in loop
poll_fun(timeout, map)
File "/usr/lib/python2.7/asyncore.py", line 156, in poll
read(obj)
File "/usr/lib/python2.7/asyncore.py", line 87, in read
obj.handle_error()
File "/usr/lib/python2.7/asyncore.py", line 83, in read
obj.handle_read_event()
File "/usr/lib/python2.7/asyncore.py", line 449, in handle_read_event
self.handle_read()
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/network/layer.py", line 86, in handle_read
self.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/network/layer.py", line 94, in receive
self.toUpper(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/stanzaregulator/layer.py", line 28, in receive
self.processReceived()
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/stanzaregulator/layer.py", line 48, in processReceived
self.toUpper(oneMessageData)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/auth/layer_crypt.py", line 63, in receive
self.toUpper(payload)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/coder/layer.py", line 35, in receive
self.toUpper(node)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/logger/layer.py", line 14, in receive
self.toUpper(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 169, in receive
s.receive(data)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/__init__.py", line 105, in receive
recv(node)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/protocol_messages/layer.py", line 20, in recvMessageStanza
entity = TextMessageProtocolEntity.fromProtocolTreeNode(node)
File "/home/astx/whatsbot/env/local/lib/python2.7/site-packages/yowsup2-2.4.48-py2.7.egg/yowsup/layers/protocol_messages/protocolentities/message_text.py", line 38, in fromProtocolTreeNode
entity.setBody(node.getChild("body").getData())
AttributeError: 'NoneType' object has no attribute 'getData'
In axolotl/layer.py -> handleEncMessage function replace try block with the following
try:
if "-" in node["from"] or node["type"] == "media":
print "Ignoring media or group message"
self.toLower(OutgoingReceiptProtocolEntity(node["id"], node["from"]).toProtocolTreeNode())
else:
if node.getChild("enc")["v"] == "2" and node["from"] not in self.v2Jids:
self.v2Jids.append(node["from"])
if node.getChild("enc")["type"] == "pkmsg":
self.handlePreKeyWhisperMessage(node)
else:
self.handleWhisperMessage(node)
this will ignore media and group messages - and send ack
Hi @pag16 thanks for the effort, but I'm still not receiving messages nor sending acks.
I updated the Nokia token after it was changed last night. and now I succeed to connect and doesn't get unauthorized but i start to get these errors when receiving messages. anyone knows what to do ??? please?