Open sealabr opened 7 years ago
Yes, just change method encryptimg from my last diff.
On Sep 9, 2017 5:21 AM, "Bjarne Roß" notifications@github.com wrote:
@bahtiarp https://github.com/bahtiarp Is that from above the final diff or is it following? I ask because some people said it works.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tgalal/yowsup/issues/2149#issuecomment-328227257, or mute the thread https://github.com/notifications/unsubscribe-auth/ADQLdBnUWbA2NIlGUf1CwdYfwqyQqlUHks5sgb3UgaJpZM4OWLf4 .
I try to do in php.. do anyone know why every time upload encoding image file get "invalid_path" url..
this encr_media url return from s.whatsapp.net.. https://mmg.whatsapp.net/u/f/TPQO_r_quLO0Kt2aKlIPuFmz5RAABVjBOflBgw/ApG0Yjm0bgnEoEWWtGC8NPhpwQ5ab8iukiPqQsA3z2Df
upload non-encoding, whatsapp return success..
@bahtiarp Can you put the diff of your files? And another questions What is a refkey in the encrpyting method??
i cant get it work please post a full diff!
Very thanks @bahtiarp
The patches to follow:
https://pastebin.com/baqG5kU3 /yowsup/common/tools.py
https://pastebin.com/vQbWVjL9 /yowsup/layers/axolotl/layer_send.py
https://pastebin.com/u3d0LDhb /yowsup/layers/protocol_media/mediauploader.py
https://pastebin.com/2vji8sr0 /yowsup/layers/protocol_media/protocolentities/iq_requestupload.py
https://pastebin.com/sgdKQh1Z /yowsup/layers/protocol_media/protocolentities/iq_requestupload_result.py
https://pastebin.com/bef8MMpV /yowsup/layers/protocol_media/protocolentities/message_media.py
https://pastebin.com/HVgJL9A6 /yowsup/layers/protocol_media/protocolentities/message_media_downloadable.py
https://pastebin.com/Q9BZSrjq /yowsup/layers/protocol_media/protocolentities/message_media_downloadable_image.py
https://pastebin.com/TfzaSE88 /yowsup/layers/protocol_messages/proto/wa_pb2.py
The patch attached: #Download HERE full patch for send image#
@bahtiarp
With your edits, sending pictures works, but there is a problem with sending longitude and latitude
File "/usr/local/lib/python2.7/dist-packages/yowsup2-2.5.2-py2.7.egg/yowsup/layers/protocol_media/protocolentities/message_media_location.py", line 58, in toProtocolTreeNode mediaNode.setAttribute("latitude", self.latitude) AttributeError: 'NoneType' object has no attribute 'setAttribute'
`
my layer.py
latitude="43.8808631897"
longitude="11.0972576141"
locationName="Piazza del duomo, 11"
locationURL="http://www.github.com"
locationEncoding="raw"
outLocation = (LocationMediaMessageProtocolEntity(latitude, longitude, locationName, locationURL, locationEncoding, to = recipient ))
self.toLower(outLocation)`
Patch is not working for Python3
Sending a image to a single contact works now, but sending a image to a group doesn't.
ERROR:yowsup.layers.protocol_media.mediauploader:Error occured at transfer bytearray index out of range
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/yowsup/layers/protocol_media/mediauploader.py", line 202, in run
self.successCallback(sourcePath, self.jid, result)
File "/usr/local/lib/python2.7/dist-packages/yowsup/demos/cli/layer.py", line 558, in <lambda>
successFn = lambda filePath, jid, url: self.doSendMedia(mediaType, filePath, url, jid, resultRequestUploadIqProtocolEntity.getIp(), caption)
File "/usr/local/lib/python2.7/dist-packages/yowsup/demos/cli/layer.py", line 545, in doSendMedia
self.toLower(entity)
File "/usr/local/lib/python2.7/dist-packages/yowsup/layers/__init__.py", line 84, in toLower
self.__lower.send(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup/layers/__init__.py", line 198, in send
s.send(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup/layers/__init__.py", line 136, in send
send(entity)
File "/usr/local/lib/python2.7/dist-packages/yowsup/layers/protocol_media/layer.py", line 35, in sendMessageEntity
self.entityToLower(entity)
File "/usr/local/lib/python2.7/dist-packages/yowsup/layers/__init__.py", line 140, in entityToLower
self.toLower(entity.toProtocolTreeNode())
File "/usr/local/lib/python2.7/dist-packages/yowsup/layers/__init__.py", line 84, in toLower
self.__lower.send(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup/layers/__init__.py", line 198, in send
s.send(data)
File "/usr/local/lib/python2.7/dist-packages/yowsup/layers/axolotl/layer_send.py", line 87, in send
self.handleEncNode(node)
File "/usr/local/lib/python2.7/dist-packages/yowsup/layers/axolotl/layer_send.py", line 54, in handleEncNode
ciphertext = sessionCipher.encrypt(messageData)
File "/usr/local/lib/python2.7/dist-packages/axolotl/sessioncipher.py", line 49, in encrypt
senderEphemeral = sessionState.getSenderRatchetKey()
File "/usr/local/lib/python2.7/dist-packages/axolotl/state/sessionstate.py", line 67, in getSenderRatchetKey
return Curve.decodePoint(bytearray(self.sessionStructure.senderChain.senderRatchetKey), 0)
File "/usr/local/lib/python2.7/dist-packages/axolotl/ecc/curve.py", line 35, in decodePoint
type = _bytes[0] # byte appears to be automatically converted to an integer??
IndexError: bytearray index out of range
self.sessionStructure.senderChain.senderRatchetKey
is empty. Any Ideas?
Have applied the patch but when I send the image, the recipient is not getting anything
my screen output is as follows
1f28794282a07f969fb00ff33cf5416163a842b3d115e0b05c1e38a79d60aeb9
filesize:42010
42010
b64Hash:mwXun4J65HlNigdco+sWWkxLxgrleb59rV40ljIyjFQ=
file_enc_sha256:9b05ee9f827ae4794d8a075ca3eb165a4c4bc60ae579be7dad5e349632328c54
_media_sender.py_ [INFO][2017-09-10 13:45:54,990] [Upload progress]0fef0b77b0eac1f2c0a9bd99a255e34b.gif => XXXXXX@s.whatsapp.net, 100%
{'mimetype': u'application/octet-stream', 'name': None, 'filehash': u'mwXun4J65HlNigdco+sWWkxLxgrleb59rV40ljIyjFQ=', 'url': u'https://mmg.whatsapp.net/d/f/Aml25cbveniWycTZzhi_RXTzK1qAf87HH-wH3bYHz8jT.enc', 'height': None, 'width': None, 'error': None, 'type': u'encrypted', 'size': u'42010'}
mediakey:1f28794282a07f969fb00ff33cf5416163a842b3d115e0b05c1e38a79d60aeb9
mimetype:image/gif
filehash:abf526cd0c5184cb51a81e6c57ee03e7a1d760a1bf909fdab443e16454629037
file_enc_sha256:9b05ee9f827ae4794d8a075ca3eb165a4c4bc60ae579be7dad5e349632328c54
MIME:image/gif
Masuk enc
mimeType: image/gif
masuk ENC
Here is the whole working Repo (image only): https://github.com/dietzi/yowsup Now I'm trying to send audio. I get no error but the message never receives....
Command for sending image:
./yowsup-cli demos -y -c /path/to/config
/L
/image send 49170xxxxxxxx image.jpg
why we should use your repo?
even the tgalal repo (patch) now sends the pictures
Sending images now working but still got issues with image/gif. The message is not being delivered, no errors. Meaning we still have 3 issues
Caption works lol!
@ventrixcode do you have diff that works the caption?
Okay so I made all changes in your diff, but It isn't working at Python 3 at all. First I had to replace unicode(...) by bytes(...) that I can run yowsupcli But now I can't send any text message nor recive anything. Program is always crashing. (Example Crash: TypeError: ord() expected string of length 1, but int found)
Image send also fails (return s + (16 - len(s) % 16) * chr(16 - len(s) % 16) TypeError: can't concat bytes to str)
@AragurDEV
Replace your pad with:
def pad(self,s):
y = (16 - len(s) % 16) * chr(16 - len(s) % 16)
a = s + y.encode()
return a
Greetings from Germany
@pabloruan0710
I will try to send diff tommorow ;) Edit: I cant figure out what i had changed... Will try my best
@ventrixcode
Thank you but now I'm faling at this step:
AttributeError: 'Message' object has no attribute 'image_message'
Greetings from Germany too ;)
Use this wa_pb2.py in yowsup/layers/protocol_messages/proto
@ventrixcode Thanks your wa_pb2.py is working fine for me. But sending an image to a group is not working. (Added you on Discord)
The caption is working. If you are using yowsup-cli to test yowsup-cli you are not passing the caption parameter to the function.
yowsup / demos / cli / layer.py
current function
@clicmd ("Send an image with optional caption") def image_send (self, number, path, caption = None): self.media_send (number, path, RequestUploadIqProtocolEntity.MEDIA_TYPE_IMAGE)
new function
@clicmd ("Send an image with optional caption") def image_send (self, number, path, caption = None): self.media_send (number, path, RequestUploadIqProtocolEntity.MEDIA_TYPE_IMAGE, caption)
@leogaletti It's not working neither
Works for me! Thanks
Em 12 de set de 2017, à(s) 12:36, AragurDEV notifications@github.com<mailto:notifications@github.com> escreveu:
@leogalettihttps://github.com/leogaletti It's not working neither
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tgalal/yowsup/issues/2149#issuecomment-328884352, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AH-wDK3JSWLg9P8ZZHcLHsK_FOLy2RVkks5shqN3gaJpZM4OWLf4.
can send imange but cannot receive image AttributeError: 'ImageDownloadableMediaMessageProtocolEntity' object has no attribute 'getMediaContent'
I think we cant send Images to Group because the storageprotos_pb2.py in axolotl is outdated.
@ventrixcode so you mean this file? https://github.com/tgalal/python-axolotl/blob/master/axolotl/state/storageprotos_pb2.py
@leogaletti Thanks its working
I made changes in library as specified in https://pastebin.com/pVxryQ12 by @bahtiarp. I managed to send image to some numbers. Thanks for the diff helped alot :)
But it gives the following error many times: Error occured at transfer bytearray index out of range
Please help!!
@AragurDEV Yes this!
@drashtived Maybe the "chat" is a group?
@ventrixcode No I am sending to a single user. I see this on console
Error occured at transfer bytearray index out of range Upload file failed!image.jpg 917588XXXXX@s.whatsapp.net https://mmg.whatsapp.net/u/f/gcmCG7cVKzsWt5mDCWaDglm5I3kABVkRPYmPnQ/AhP8NZqLXz_rpIdcrmH-Am1kmCly-JL0HwGg4UMY3bUq
Working fine now in Python 3.6.2.
I have been forked Yowsup and pushed my code version, feel free to clone: https://github.com/alancpazetto/yowsup
Thanks for all.
@alancpazetto Nope send Image to Group is still broken!
@ventrixcode Sorry about that, I didn't test to groups, only for contacts.
I got sending to group working. Just download my fork: https://github.com/AragurDEV/yowsup Or look at my commit: https://github.com/AragurDEV/yowsup/commit/40dd8680bd3d0242da9691584c16e96a03dde9e0 layer_send.py starting line 51
If you need any assistance jump on our support discord: https://discord.gg/Wa7QSxZ
Now I can send audio-files. But only those are generated by WhatsApp-App. If i try to send a mp3 or something else it doesn't download the message. I had send a "voice-file" from my WhatsApp via e-mail and sent this file back to the phone via yowsup.
/audio send 4917***** voice.opus
See my Repo for changes (https://github.com/dietzi/yowsup)
Changes have to be done here for sending mp3: https://github.com/dietzi/yowsup/blob/master/yowsup/layers/protocol_media/protocolentities/message_media_downloadable_audio.py#L109
Got it. The error was on generating the encryption-key. See here: https://github.com/dietzi/yowsup/blob/master/yowsup/layers/protocol_media/mediauploader.py#L55
Now sending audio work's
Only we have to implement a function to get the duration of the audio-file
Please make an new Issue then, wrong Issue @dietzi add me on Discord VentrixCode#6897
@tgalal you can Close this Issue i think!
@AragurDEV Hi, i fork your code, i got error "hex() argument can't be converted to hex", what i missing?
/yowsup-master/yowsup/structs/protocoltreenode.py", line 56, in toString val = ''.join(['%' + hex(b)[2:] for b in val]) TypeError: hex() argument can't be converted to hex
@AragurDEV @mhuzqu
@AragurDEV Hi, i fork your code, i got error "hex() argument can't be converted to hex", what i missing?
I have the same error when trying to run the script. Could you share with us the only part that you chaged to get the groups working
@mhuzqu @drmaposa which Python version are you using? And also can i please get the complete dump? And also detailed information in what you are doing?
@drmaposa I dindn't change anything else. I tested it with Python 3.4 and it works fine.
Hi @AragurDEV i use Python 2.7, then i jump to use python3 version 3.6.1 dan install pip3, send message work fine (when used 2.7 are fail), then i try send image using "/image send path/file.jpg" still error:
[connected]:/image send xxnumberxx /opt/img.jpg ERROR:yowsup.common.optionalmodules:PIL import failed100% ERROR:yowsup.common.optionalmodules:PIL import failed
the error caused pillow module is not installed, so i run the "pip3 install pillow", then try send image. viola, send images work perfectly.... awesome @AragurDEV thankyou...
@drmaposa try to install python3, install pip3, install pillow via pip3, should work.....
@mhuzqu As you can see in the README.md:
Required python packages for yowsup-cli: argparse, readline (or pyreadline for windows), pillow (for sending images)
So my fork only works with Python 3 not Python 2.7? Maybe I should investegate that.
@AragurDEV yups, your code doesn't work on python 2.7. In my case, on python2 pillow already installed, when i install the python3, i forgot to install pillow.
when we run yowsup using this command below:
python3 yowsup-cli demos -c yowsup-cli_1.config -s xxnumberxxx "sending message"
would you please tell me which class and method in Yowsup will be execute?
@mhuzqu What do you mean by that?
would you please tell me which class and method in Yowsup will be execute?
Also I would be pleased if you can send me the full crash on python 2.7 (I'm currently at work and can't test it)
@AragurDEV i mean, i tried to figure out when we use command ' phyton yowsup-cli demos -c config.config -s xxnumberxx "message" ', is that command execute the method onSendAndExit located in /yowsup/demos/cli/layer.py or another method in another class ??
here is the trace log:
Traceback (most recent call last): File "yowsup-cli", line 368, in
if not parser.process(): File "yowsup-cli", line 272, in process self.startSendClient() File "yowsup-cli", line 324, in startSendClient stack.start() File "/yowsup/demos/sendclient/stack.py", line 31, in start self.stack.loop() File "/yowsup/stacks/yowstack.py", line 196, in loop asyncore.loop(*args, **kwargs) File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py", line 216, in loop poll_fun(timeout, map) File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py", line 162, in poll write(obj) File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py", line 95, in write obj.handle_error() File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py", line 91, in write obj.handle_write_event() File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py", line 467, in handle_write_event self.handle_connect_event() File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py", line 455, in handle_connect_event self.handle_connect() File "/yowsup/layers/network/layer.py", line 82, in handle_connect self.emitEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECTED)) File "/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/yowsup/layers/init.py", line 94, in emitEvent self.upper.emitEvent(yowLayerEvent) File "/yowsup/layers/init.py", line 88, in emitEvent if self.upper and not self.upper.onEvent(yowLayerEvent): File "/yowsup/layers/init.py", line 212, in onEvent stopEvent = stopEvent or s.onEvent(yowLayerEvent) File "/yowsup/layers/init.py", line 109, in onEvent return self.event_callbackseventName File "/yowsup/layers/auth/layer_authentication.py", line 57, in onConnected self.login() File "/yowsup/layers/auth/layer_authentication.py", line 63, in login self._sendAuth() File "/yowsup/layers/auth/layer_authentication.py", line 110, in _sendAuth self.entityToLower(AuthProtocolEntity(self.credentials[0], passive=passive, nonce=authBlob)) File "/yowsup/layers/init.py", line 140, in entityToLower self.toLower(entity.toProtocolTreeNode()) File "/yowsup/layers/init.py", line 84, in toLower self.lower.send(data) File "/yowsup/layers/init.py", line 198, in send s.send(data) File "/yowsup/layers/axolotl/layer_send.py", line 115, in send self.toLower(node) File "/yowsup/layers/init.py", line 84, in toLower self.__lower.send(data) File "/yowsup/layers/axolotl/layer_control.py", line 34, in send self.toLower(node) File "/yowsup/layers/init.py", line 84, in toLower self.lower.send(data) File "/yowsup/layers/logger/layer.py", line 8, in send logger.debug("tx:\n%s" % ldata) File "/yowsup/structs/protocoltreenode.py", line 90, in str return self.toString() File "/yowsup/structs/protocoltreenode.py", line 56, in toString val = ''.join(['%' + hex(b)[2:] for b in val]) TypeError: hex() argument can't be converted to hex
@mhuzqu Thank you for your trace log - I will investegate this. Here you can find the callbacks called when enter a command in the yowsup cli: https://github.com/AragurDEV/yowsup/blob/master/yowsup/demos/cli/layer.py
@drmaposa I dindn't change anything else. I tested it with Python 3.4 and it works fine.
I have Python 2.7 and can we work out a solution for both Python 2 and 3
@drmaposa
Could you please add print repr(b)
ahead of line 56 in "/yowsup/structs/protocoltreenode.py", recompile, install yowsup and send me the output? (before the crash happens)
hiii @drmaposa
File "/tested/yowsup/layers/logger/layer.py", line 8, in send logger.debug("tx:\n%s" % ldata) File "/tested/yowsup/structs/protocoltreenode.py", line 91, in str return self.toString() File "/tested/yowsup/structs/protocoltreenode.py", line 56, in toString print repr(b) UnboundLocalError: local variable 'b' referenced before assignment
okay sry I made a mistake
instead print repr(b)
paste this:
for b in val:
print repr(b)
Hello I'm trying to upload media by yowsup, using
RequestUploadIqProtocolEntity
but it's not possible because lambda function allways direct toonRequestUploadError
, and cant send file ...Request upload for file /tmp/jpeg.jpg for 5524XXXXXXXX@s.whatsapp.net failed
I also tried with yowsupCLI using image send
/image send 5524XXXXXX /tmp/3DCDA9A9436B01F9A3.jfif