venomous0x / WhatsAPI

Interface to WhatsApp Messenger
2.59k stars 2.13k forks source link

sendMessage doesn't send? #4

Closed xTraXx closed 12 years ago

xTraXx commented 12 years ago

I tried the python script, and the login seems to work (When I use the sendMessage function I get a Last seen: "long code here") But the message isn't sent (The receiver doesn't receive them.) I used these parameters:

start("", "<md5 hashed(reversed EMEI)>") sendMessage("1", "", "Does it work?")

For the i parameter I used a couple of numbers (1,2,3). I also tested it with other receivers.

MHaendel commented 12 years ago

Check the PHP Version, I think i = time() - 1

venomous0x commented 12 years ago

timestamp + dash + any number note that number after dash will only be valid once , means either timestamp or number will be increased after sending i.e : 1338320323-1 .. 1338320323-2 .. 1338320323-3

xTraXx commented 12 years ago

I did this and it's still not working: start("Countrycode + my phone number", "md5hashed(reversed EMEI)") sendMessage(str(int(time.time())) + "-1", "Countrycode + receiver phone number", "Does it work?")

The script output: Last read ===> '\x00+\xf8\x08H8\xfa\xfc\x0bPHONENUMBER\x8aC\x05\xa2/\xf8\x01\xf8\x06/\x1d\xfc\x03404\xa2\x18\xf8\x01\xf8\x03J\xbd\xa9'

So it does something, but I didn't receive the message. (Note that I got this output also with i = 1 or 2 instead of the timestamp)

onny commented 12 years ago

I'm having exactly the same issue. I'm getting an answer from the server, which I usually don't get if the login credentials aren't correct. But then the script stops/hangs, trying to receive an answer after sending a message. Unfortunately the recipient doesn't get the message.

onny commented 12 years ago

Now I've received a really obvious answer from the server, lol: Last read (login) ===> '\x00\t\xf8\x07t8\x8a\x94+\xbd\xb6' Last read (msgsend) ===> '\x01\n\xf8\n]8\xfa\xfc\x06Server\x8aC\xfc\x0515490\xa2\x1b\x9d\xfc\n1338390608\xf8\x01\xf8\x02\x16\xfc\xdeNew version of WhatsApp Messenger is now available. Please visit http://www.whatsapp.com/appstore/ and upgrade to the latest version. Your upgrade will be free and will bring bug fixes and new features such as Group Icons!' Last read (msgsend) ===> '\x00\x10\xf8\x02\x95\xf8\x02\xf8\x03 \xbd\xaa\xf8\x04\xc7\xbd\xaa\x82\x00\x03\xf8\x01\x02'

MHaendel commented 12 years ago

This API uses an outdated protocol.

xTraXx commented 12 years ago

Uhm the sending mechanism isn't working yet? Or am I doing something wrong?

onny commented 12 years ago

yeah it's still not working

alexprovencio commented 12 years ago

i tried yesterday the php version and it was working fine

jonymusky commented 12 years ago

I get the account_info but unfortunately the recipient doesn't get the message.

onny commented 12 years ago

sinconexion, could you please explain what you entered into the example.php file and do you have a special apache-webserver setup?

alexprovencio commented 12 years ago

i used my mobile phone number and imei reversed and then hashed as password, but it also works with the android emulator from the sdk (imei 000000000000000), of course you have to activate whatsapp before in the mobile or the android emulator for the number you are using to login, and add to that number and the one you are sending the messages the country codes (in my case 34 for spain)

i didn't use a web server, just exec the script using php from the command line, i'm using Ubuntu 12.04 and php 5.3.10

xTraXx commented 12 years ago

Yea the PHP script is working! :D (just used usb webserver)

require "whatsapp.v2.php";

// DEMO OF USAGE $wa = new WhatsApp("your number", "pass"); $wa->Connect(); $wa->Login();

$wa->Message(time()."-1","phonenumber", "message");

MHaendel commented 12 years ago

Seems the iphone password differs.

beeNetworks GmbH Brauerweg 10 / 26419 Schortens http://www.beeNetworks.net

Geschäftsführer: Sebastian Constapel http://sebastianconstapel.de Telefon: + 49 151 588 222 72 Steuernummer: 70/200/46178 UstID: DE265158811 Amtsgericht Oldenburg HRB 203417

Am 31.05.2012 um 09:55 schrieb "xTraXx" reply@reply.github.com:

Yea the PHP script is working! :D (just used usb webserver)

require "whatsapp.v2.php";

// DEMO OF USAGE $wa = new WhatsApp("your number", "pass"); $wa->Connect(); $wa->Login();

$wa->Message(time()."-1","phonenumber", "message");


Reply to this email directly or view it on GitHub: https://github.com/venomous0x/WhatsAPI/issues/4#issuecomment-6029920

johnhout commented 12 years ago

I can't seems to find out how a iPhone password is defined, I understand its the UDID but does this also needs to be strrev and md5? or what is the format?

xTraXx commented 12 years ago

Yea, but try the php version, the python script doesn't work for me. UDID --> reverse ---> md5

BTW can you send me a packet capture file (wireshark) of a login + send and receive message of whatsapp?(So just send an message to yourself). Because the packet structure of android seems to be different and this API is based on an iPhone.

I'm also dutch btw ^^,

johnhout commented 12 years ago

Hm oké so this should be the following: ( werkt bij mij niet ).

$wa = new WhatsApp("31600000000", md5(strrev('UDID'))); 

VIVA H.....

xTraXx commented 12 years ago

In principe moet dat kloppen, ik heb alleen geen functie gebruikt, maar gewoon zelf de string omgedraaid en gehashed, maar dat zou niet uit moeten maken lijkt me.

//

That should be right, but I didn't use any functions, I just reversed the string and then hashed it manually, but that shouldn't be the problem.

johnhout commented 12 years ago

heb jij toevallig google talk ofzo haha?

xTraXx commented 12 years ago

yea

dsdsfga commented 12 years ago

Same problem here the message is not send. I can login and see that the message is send out in wireshark but then the server not react. If I guess right the codes hangs in the first read line after this line: $stream = $this->send($msg);

lukasklein commented 12 years ago

Same for me... The server does not respond with a single byte

dsdsfga commented 12 years ago

I'm comparing the bytes which are send by the android app in the emulator and modified that the output to be 1:1 exactly the same. The server does not react but I just see that the auth is a little other than in android.

Android sends: realm="s.whatsapp.net",response=...,nonce="...",digest-uri="xmpp/s.whatsapp.net",cnonce="...", qop=auth,username="...",nc=00000001 WhatsAPI sends: username="...",realm="...",nonce="...",cnonce="...",nc=...,qop=...,digest-uri="...",response=...,charset=utf-8

The order does not match but this is maybe not important but the "charset=utf-8" is missing in the android output. I'm checking that...

I rewrote that auth code so that the charset part is missing.. and it works!

ozonostudio commented 12 years ago

anyone can please tell me from where i download the "whatsapp.v2.php" file?

ccchan27 commented 12 years ago

yeah! Where is whatsapp.v2.php?

Besides, UDID on iPhone, how about Android? IMEI?

vkotovv commented 12 years ago

@ccchan27 You could use whatsapp.class.php instead, it works for me, at least for login and sending text messages

assegaf commented 12 years ago

@vkotovv can you exactly explain to us how you did it, android/iphone whatsapp ?, modification at WhatsApi ? other different ? I can login, but sending is not, also login is too long, sometime get message outdated ..

vkotovv commented 12 years ago

@assegaf Here is the content of my example.php:

<?php
require "whatsapp.class.php";

// DEMO OF USAGE
$wa = new WhatsApp("7904xxxxxxxx", "3727305342fc1788f9e170a6bb8a47d4");
$wa->Connect();
$wa->Login();

// SEND A MESSAGE
$str = "Hello world!";
$wa->Message(time()."-1","7950xxxxxxxx",$str);
?>

But password (encoded IMEI) was not generated by this php code, I could present my version..

assegaf commented 12 years ago

looks like you are not modifying some codes, and work out of box, mine still not working on sending. did you use iPhone for registration ?

vkotovv commented 12 years ago

@assegaf No, Android.