venomous0x / WhatsAPI

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

Whatsapi working again with help from yowsup and googlevoice. #238

Open jonnywilliamson opened 11 years ago

jonnywilliamson commented 11 years ago

Ok firstly there's going to be a bit of a rant at the start before I give you my results.

It just seems incredible to me how many people take the time to find this repository, find the issues section and then without even taking 2 secs to look at the other threads in here - create a brand new issue and ask the same question as 400 other people immediate below them. I'm tired of getting dozens of emails that are all CRAP.

Come on people SMARTEN UP. You are not ALL stupid.

Also can we just clear up some issues once and for all.

1) If you're using v1 of the authentication proceedure (ie everything up until the changes a few weeks ago) and things are still working for you, you are living on borrowed time. Sooner or later you will find that you cannot connect. You will know this by the error message "incorrect password". Do not come here and tell us about it, we know.

2) It seems fairly clear now. WHATSAPP NOW ASSIGN A PASSWORD to each user account, THERE IS NO WAY TO GENERATE IT ANYMORE. You must discover what your new password is, there's no more generating it from your phones IMEI or MAC address.

3) To those people who have been sending more than 10,000 messages a day and complained about being blocked - I call shenanigans. You are spammers. I HATE spammers, I'm delighted your accounts have been blocked.

So as we continue what am I showing you?

I have finally found away to (easily) get the password for a particular whatsapp account, and I have modified the code in whatsapi to use this password to allow me to send messages again. This solution will NOT help everyone.

A lot of you will want to use the SAME account as your phone (in my case iphone), THIS IS NOT POSSIBLE USING MY SOLUTION AT THE MOMENT.

I have been unable to find a way to extract the password from my phone, therefore I used yowsup and my googlevoice number to create a new account and capture the password from there before using it in WHATSAPI.

HOWEVER when someone finds a way to read the password file stored on the iphone etc we will be able to use the rest of my solution below.

Here's what I did.

a) Download YOWSUP from https://github.com/tgalal/yowsup . This is a python implementation of whatsapp and will allow us to register and capture our new account password. You will need a server that has python installed to be able to use this. Move all the YOWSUP files to your server.

b) Edit the config.example file in the yowsup directory. Place your googlevoice number in the config file. It should look like this:

phone=12225556666
d=
password=

c) run the yowsup-cli file with the following parameters:

 python ./yowsup-cli -c config.example -d --requestcode voice

You will see the connection being made to whatsapp and after a few secs whatsapp will make a voicecall to your googlevoice number with the confirmation code.

In my case I let googlevoicemail pick up the call and record the message. I was then able to play the message back and hear my confirmation code. I didn't check to see if googlevoice would receive a sms message from whatsapp. If you would like to try this method, then run this command:

 python ./yowsup-cli -c config.example -d --requestcode sms

d) Now we need to finish the registration by sending the confirmation code back. Run this command:

 python ./yowsup-cli -c config.example -d -R 123456

Where 123456 is your 6 digit confirmation code. If success full you will see something like this:

status: ok kind: free pw: YOURPASSWORDISHERE price: $0.99 price_expiration: 1359720290 currency: USD cost: 0.99 expiration: 1388155832 login: type: new

e) Now take/copy your password, if you like you are now finished with yowsup.

f) The password you have is a base64 encoded string containing your password. We have to now add a way for WHATSAPI to be able to use it. There's 2 code changes we have to make to the current code to get this to work.

open whatsprot.class.php find

    protected $_whatsAppVer = "2.8.4";

change to

    protected $_whatsAppVer = "2.8.7";

find

    public function encryptPassword()
    {
        if(stripos($this->_imei, ":") !== false){
            $this->_imei = strtoupper($this->_imei);
            return md5($this->_imei.$this->_imei);
        }
        else {
            return md5(strrev($this->_imei));
        }
    }

and replace with

    public function encryptPassword()
    {
        return base64_decode($this->_imei);
    }

Now you are good to go! To use a very quick proof, create this php file and enter your details, then run the file, you should receive a message after a second.

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

    $fromMobNumber = "12225556666"; //ENTER YOUR GOOGLEVOICENUMBER HERE
    $toMobNumber = "09876543210"; //ENTER YOUR OWN NUMBER HERE
    $id = "<YOUR NEW PASSWORD>";  //ENTER THE PASSWORD YOU COPIED EARLIER HERE
    $nick = "YourNick";

    $w = new WhatsProt($fromMobNumber, $id, $nick);
    $w->Connect();
    $w->Login();
    $w->sendNickname($nick);
    $w->Message($toMobNumber , "Testing123");
    sleep (2);

?>
krish-kapadia commented 11 years ago

Here is the output

D:\Python33>python ./yowsup-cli -c config.example -d --requestcode sms GET {'User-Agent': 'WhatsApp/2.4.22 S40Version/14.26 Device/Nokia302', 'Accept': 'te xt/json'} cc=91&in=9978843611&lc=IN&lg=en&mcc=000&mnc=000&method=sms&id=19de191ef2f16489d8 0f011828b4026f&token=c21475793368afbec851f087c8986da0 Opening connection to v.whatsapp.net Requesting /v2/code?cc=91&in=9978843611&lc=IN&lg=en&mcc=000&mnc=000&method=sms&i d=19de191ef2f16489d80f011828b4026f&token=c21475793368afbec851f087c8986da0 WACodeRequest: b'{"status":"sent","length":6,"method":"sms","retry_after":25205 }\n' retry_after: 25205 length: 6 status: sent method: sms

Config File

cc=91 phone=919978843611 id=358904045415131 password=

Plz tell me if I'm doing something wrong...Still I didn't get the SMS.

shirioko commented 11 years ago

We already know the output and we already know it's broken. It's been broken for weeks if not months now, and if people would read the other issues we would not have comments about it each day.

patelsagar commented 9 years ago

Dear All Friends,

Whatsapp Message Send using php Not Working

        $nickname = "Bhavesh Lakum"; // Your nickname
        $sender = "****************"; // Number with country code
        $imei = "359301057212815"; // Not used
        $password = sha1("******"); // Password you received from WhatsApp (Using WART, WhatsAPI...)
        $dst = "***************"; // Number with country code (target to send a message)
        $wa = new WhatsProt($sender, $imei, $nickname, TRUE);
        $wa->connect();
        $wa->loginWithPassword($password);
        $wa->sendMessage($dst, "You have sent a message correctly, so you've connected to WhatsApp");

Error Display :-

tx stream:features tx tx tx tx tx /stream:features

tx

rx

rx stream:features/stream:features

rx on©›ôø\µžµ¢’SUw÷j 23

tx –”½¼ñ´™?SÖI(ı™fMl·­M‹ôâÍjˆÿ='1ð%q

Fatal error: Uncaught exception 'Exception' with message 'Login Failure' in /opt/lampp/htdocs/WhatsAPI-Official-master/src/whatsprot.class.php:2014 Stack trace: #0 /opt/lampp/htdocs/WhatsAPI-Official-master/src/whatsprot.class.php(526): WhatsProt->doLogin() #1 /opt/lampp/htdocs/WhatsAPI-Official-master/example.php(55): WhatsProt->loginWithPassword('7c5c7deef3e7ef1...') #2 {main} thrown in /opt/lampp/htdocs/WhatsAPI-Official-master/src/whatsprot.class.php on line 2014

Plz Solution Me

OrangeTux commented 9 years ago

@sagar551993 Maybe you should remove phone numbers and and password.

patelsagar commented 9 years ago

@OrangeTux
Thank You

mgp25 commented 9 years ago

@sagar551993 your number have been blocked, try resetting password if not working you will need a new number. As i said you before in this repository is no longer being supported. We are giving support + latest updates here: https://github.com/mgp25/WhatsAPI-Official

patelsagar commented 9 years ago

@mgp25 Plz help Me Not number Block script use :https://github.com/mgp25/WhatsAPI-Official Login Failure Error Display

mgp25 commented 9 years ago

What script are you using? If its one of your own post the code here, if its any example, send link, be sure to ask the future doubts in the new repository.

If you are using latest code from WhatsAPI Official then your number is blocked, resetting your password with WART or WhatsAPI depends what did you use to register the number

morethanequal commented 8 years ago

@mgp25 Hi mgp25 can you please help me... i'm using https://github.com/mgp25/WhatsAPI-Official repository & following code require_once 'whatsprot.class.php'; echo "ok"; $username = "49xxxxxxxxxxxxxxxx"; //Mobile Phone prefixed with country code so for india it will be 91xxxxxxxx $password = "xxxxxxxxxxxxxxxxxxxxxx"; $debug = false; $nickname = "xxxxx";

$w = new WhatsProt($username, $identity, $nickname, false); $w->connect(); $w->loginWithPassword($password);

$target = '49xxxxxxxxxxxxx'; //Target Phone,reciever phone $message = 'Test Message';

$w->SendPresenceSubscription($target); //Let us first send presence to user $w->sendMessage($target,$message ); // Send Message

i'm not getting any error message or anything...

I generated new password using WART.. never ever used that number anywhere else