2016-10-11 2 views
0

나는 Yowsup cli를 사용하여 whatsapp를 사용하여 메시지를 보내고받습니다. 등록하고 메시지를 보낼 수 있습니다. 그러나이 명령을 실행하여 들어오는 메시지를 청취 할 때 :yowsup cli echo에서 메시지 보낸 사람을 얻는 방법은 무엇입니까?

yowsup-cli demos --login number:password --echo -E s40 

메시지 텍스트를 볼 수는 있지만 메시지 보낸 사람은 누구인지 알 수 없습니다. yowsup-cli를 사용하여 어떻게 얻을 수 있습니까?

yowsup-cli v2.0.15 
yowsup  v2.5.0 

Copyright (c) 2012-2016 Tarek Galal 
http://www.openwhatsapp.org 

This software is provided free of charge. Copying and redistribution is 
encouraged. 

If you appreciate this software and you would like to support future 
development please consider donating: 
http://openwhatsapp.org/yowsup/donate 


WARNING:yowsup.layers.axolotl.layer_receive:Received a message that we've previously decrypted, goint to send the delivery receipt myself 
DUMP: 

Teste 8 
['\n', '\x07', 'T', 'e', 's', 't', 'e', ' ', '8'] 
[10, 7, 84, 101, 115, 116, 101, 32, 56] 
Traceback (most recent call last): 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 1087, in MergeFromString 
    if self._InternalParse(serialized, 0, length) != length: 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 1109, in InternalParse 
    (tag_bytes, new_pos) = local_ReadTag(buffer, pos) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/protobuf/internal/decoder.py", line 181, in ReadTag 
    while six.indexbytes(buffer, pos) & 0x80: 
TypeError: unsupported operand type(s) for &: 'str' and 'int' 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "/Library/Frameworks/Python.framework/Versions/3.5/bin/yowsup-cli", line 368, in <module> 
    if not parser.process(): 
    File "/Library/Frameworks/Python.framework/Versions/3.5/bin/yowsup-cli", line 270, in process 
    self.startEcho() 
    File "/Library/Frameworks/Python.framework/Versions/3.5/bin/yowsup-cli", line 308, in startEcho 
    stack.start() 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/demos/echoclient/stack.py", line 21, in start 
    self.stack.loop() 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/stacks/yowstack.py", line 196, in loop 
    asyncore.loop(*args, **kwargs) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncore.py", line 203, in loop 
    poll_fun(timeout, map) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncore.py", line 150, in poll 
    read(obj) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncore.py", line 87, in read 
    obj.handle_error() 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncore.py", line 83, in read 
    obj.handle_read_event() 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncore.py", line 423, in handle_read_event 
    self.handle_read() 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/network/layer.py", line 102, in handle_read 
    self.receive(data) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/network/layer.py", line 110, in receive 
    self.toUpper(data) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/__init__.py", line 76, in toUpper 
    self.__upper.receive(data) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/stanzaregulator/layer.py", line 29, in receive 
    self.processReceived() 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/stanzaregulator/layer.py", line 52, in processReceived 
    self.processReceived() 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/stanzaregulator/layer.py", line 49, in processReceived 
    self.toUpper(oneMessageData) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/__init__.py", line 76, in toUpper 
    self.__upper.receive(data) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/auth/layer_crypt.py", line 65, in receive 
    self.toUpper(payload) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/__init__.py", line 76, in toUpper 
    self.__upper.receive(data) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/coder/layer.py", line 35, in receive 
    self.toUpper(node) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/__init__.py", line 76, in toUpper 
    self.__upper.receive(data) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/logger/layer.py", line 14, in receive 
    self.toUpper(data) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/__init__.py", line 76, in toUpper 
    self.__upper.receive(data) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/axolotl/layer_control.py", line 44, in receive 
    self.toUpper(protocolTreeNode) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/__init__.py", line 76, in toUpper 
    self.__upper.receive(data) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/__init__.py", line 189, in receive 
    s.receive(data) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/axolotl/layer_receive.py", line 41, in receive 
    self.onMessage(protocolTreeNode) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/axolotl/layer_receive.py", line 74, in onMessage 
    self.handleEncMessage(protocolTreeNode) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/axolotl/layer_receive.py", line 88, in handleEncMessage 
    self.handleWhisperMessage(node) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/axolotl/layer_receive.py", line 144, in handleWhisperMessage 
    self.parseAndHandleMessageProto(encMessageProtocolEntity, plaintext[:-padding]) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/yowsup/layers/axolotl/layer_receive.py", line 171, in parseAndHandleMessageProto 
    m.ParseFromString(serializedData) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/protobuf/message.py", line 185, in ParseFromString 
    self.MergeFromString(serialized) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/protobuf/internal/python_message.py", line 1093, in MergeFromString 
    raise message_mod.DecodeError('Truncated message.') 
google.protobuf.message.DecodeError: Truncated message. 

답변

1

사실, 이것은 파이썬 3.5를 사용할 때 발생하는 문제는 다음과 같습니다

내 결과입니다. 그래서 파이썬 2.7을 사용했고 해결되었습니다.

0

은 왜

yowsup \ 데모에서 파일을 이동하지 않습니다 \ echoclient \ layer.py

하고

print("Echoing %s to %s" % (messageProtocolEntity.getBody(), messageProtocolEntity.getFrom(False))) 

편집을 필요로하는 파일을 편집 이 선은 충분하지만이 바로 아래에 다른 인쇄 선을 배치 할 수 있습니다.

print("Echoing %s to %s" % (messageProtocolEntity.getBody(), messageProtocolEntity.getFrom(False))) 
print("Sender is : "+messageProtocolEntity.getFrom(False)) 
관련 문제