Skip to content

Commit

Permalink
Updated token and fixed slow login
Browse files Browse the repository at this point in the history
Fixes #876
Fixes #778
Fixes #822
  • Loading branch information
shirioko committed Aug 12, 2014
1 parent c1fd0a9 commit 9832b1d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/token.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

function generateRequestToken($country, $phone) {
$signature = "MIIDMjCCAvCgAwIBAgIETCU2pDALBgcqhkjOOAQDBQAwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDASBgNVBAcTC1NhbnRhIENsYXJhMRYwFAYDVQQKEw1XaGF0c0FwcCBJbmMuMRQwEgYDVQQLEwtFbmdpbmVlcmluZzEUMBIGA1UEAxMLQnJpYW4gQWN0b24wHhcNMTAwNjI1MjMwNzE2WhcNNDQwMjE1MjMwNzE2WjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEUMBIGA1UEBxMLU2FudGEgQ2xhcmExFjAUBgNVBAoTDVdoYXRzQXBwIEluYy4xFDASBgNVBAsTC0VuZ2luZWVyaW5nMRQwEgYDVQQDEwtCcmlhbiBBY3RvbjCCAbgwggEsBgcqhkjOOAQBMIIBHwKBgQD9f1OBHXUSKVLfSpwu7OTn9hG3UjzvRADDHj+AtlEmaUVdQCJR+1k9jVj6v8X1ujD2y5tVbNeBO4AdNG/yZmC3a5lQpaSfn+gEexAiwk+7qdf+t8Yb+DtX58aophUPBPuD9tPFHsMCNVQTWhaRMvZ1864rYdcq7/IiAxmd0UgBxwIVAJdgUI8VIwvMspK5gqLrhAvwWBz1AoGBAPfhoIXWmz3ey7yrXDa4V7l5lK+7+jrqgvlXTAs9B4JnUVlXjrrUWU/mcQcQgYC0SRZxI+hMKBYTt88JMozIpuE8FnqLVHyNKOCjrh4rs6Z1kW6jfwv6ITVi8ftiegEkO8yk8b6oUZCJqIPf4VrlnwaSi2ZegHtVJWQBTDv+z0kqA4GFAAKBgQDRGYtLgWh7zyRtQainJfCpiaUbzjJuhMgo4fVWZIvXHaSHBU1t5w//S0lDK2hiqkj8KpMWGywVov9eZxZy37V26dEqr/c2m5qZ0E+ynSu7sqUD7kGx/zeIcGT0H+KAVgkGNQCo5Uc0koLRWYHNtYoIvt5R3X6YZylbPftF/8ayWTALBgcqhkjOOAQDBQADLwAwLAIUAKYCp0d6z4QQdyN74JDfQ2WCyi8CFDUM4CaNB+ceVXdKtOrNTQcc0e+t";
$classesMd5 = "+XW/7rCZDX9T7YrGQqTmcg==";
$classesMd5 = "pZ3J/O+F3HXOyx8YixzvPQ==";

$key2 = base64_decode("/UIGKU1FVQa+ATM2A0za7G2KI9S/CwPYjgAbc67v7ep42eO/WeTLx1lb1cHwxpsEgF4+PmYpLd2YpGUdX/A2JQitsHzDwgcdBpUf7psX1BU=");
$data = base64_decode($signature) . base64_decode($classesMd5) . $phone;
Expand Down
29 changes: 14 additions & 15 deletions src/whatsprot.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class WhatsProt
const WHATSAPP_SERVER = 's.whatsapp.net'; // The hostname used to login/send messages.
const WHATSAPP_UPLOAD_HOST = 'https://mms.whatsapp.net/client/iphone/upload.php'; // The upload host.
const WHATSAPP_DEVICE = 'Android'; // The device name.
const WHATSAPP_VER = '2.11.209'; // The WhatsApp version.
const WHATSAPP_USER_AGENT = 'WhatsApp/2.11.209 Android/4.3 Device/GalaxyS3';// User agent used in request/registration code.
const WHATSAPP_VER = '2.11.301'; // The WhatsApp version.
const WHATSAPP_USER_AGENT = 'WhatsApp/2.11.301 Android/4.3 Device/GalaxyS3';// User agent used in request/registration code.

/**
* Property declarations.
Expand Down Expand Up @@ -1637,19 +1637,18 @@ protected function doLogin()
$this->sendNode($feat);
$this->sendNode($auth);

$this->pollMessages();
$cnt = 0;
do {
$this->pollMessages();
if($this->challengeData != null) {
$data = $this->createAuthResponseNode();
$this->sendNode($data);
$this->reader->setKey($this->inputKey);
$this->writer->setKey($this->outputKey);
$this->pollMessages();
}
} while ($this->challengeData == null && ($cnt++ < 100) && (strcmp($this->loginStatus, static::DISCONNECTED_STATUS) == 0));

$this->pollMessage();
$this->pollMessage();
$this->pollMessage();

if($this->challengeData != null) {
$data = $this->createAuthResponseNode();
$this->sendNode($data);
$this->reader->setKey($this->inputKey);
$this->writer->setKey($this->outputKey);
$this->pollMessage();
}

if(strcmp($this->loginStatus, static::DISCONNECTED_STATUS) == 0)
{
throw new Exception('Login Failure');
Expand Down

3 comments on commit 9832b1d

@saintclair
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great #improve #very #fast

@shirioko
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye

@vibhoo
Copy link

@vibhoo vibhoo commented on 9832b1d Aug 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(y) now it's fast enough thanks for the improvement

Please sign in to comment.