Skip to content

Commit 9832b1d

Browse files
committed
Updated token and fixed slow login
Fixes #876 Fixes #778 Fixes #822
1 parent c1fd0a9 commit 9832b1d

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

src/token.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

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

88
$key2 = base64_decode("/UIGKU1FVQa+ATM2A0za7G2KI9S/CwPYjgAbc67v7ep42eO/WeTLx1lb1cHwxpsEgF4+PmYpLd2YpGUdX/A2JQitsHzDwgcdBpUf7psX1BU=");
99
$data = base64_decode($signature) . base64_decode($classesMd5) . $phone;

src/whatsprot.class.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class WhatsProt
4646
const WHATSAPP_SERVER = 's.whatsapp.net'; // The hostname used to login/send messages.
4747
const WHATSAPP_UPLOAD_HOST = 'https://mms.whatsapp.net/client/iphone/upload.php'; // The upload host.
4848
const WHATSAPP_DEVICE = 'Android'; // The device name.
49-
const WHATSAPP_VER = '2.11.209'; // The WhatsApp version.
50-
const WHATSAPP_USER_AGENT = 'WhatsApp/2.11.209 Android/4.3 Device/GalaxyS3';// User agent used in request/registration code.
49+
const WHATSAPP_VER = '2.11.301'; // The WhatsApp version.
50+
const WHATSAPP_USER_AGENT = 'WhatsApp/2.11.301 Android/4.3 Device/GalaxyS3';// User agent used in request/registration code.
5151

5252
/**
5353
* Property declarations.
@@ -1637,19 +1637,18 @@ protected function doLogin()
16371637
$this->sendNode($feat);
16381638
$this->sendNode($auth);
16391639

1640-
$this->pollMessages();
1641-
$cnt = 0;
1642-
do {
1643-
$this->pollMessages();
1644-
if($this->challengeData != null) {
1645-
$data = $this->createAuthResponseNode();
1646-
$this->sendNode($data);
1647-
$this->reader->setKey($this->inputKey);
1648-
$this->writer->setKey($this->outputKey);
1649-
$this->pollMessages();
1650-
}
1651-
} while ($this->challengeData == null && ($cnt++ < 100) && (strcmp($this->loginStatus, static::DISCONNECTED_STATUS) == 0));
1652-
1640+
$this->pollMessage();
1641+
$this->pollMessage();
1642+
$this->pollMessage();
1643+
1644+
if($this->challengeData != null) {
1645+
$data = $this->createAuthResponseNode();
1646+
$this->sendNode($data);
1647+
$this->reader->setKey($this->inputKey);
1648+
$this->writer->setKey($this->outputKey);
1649+
$this->pollMessage();
1650+
}
1651+
16531652
if(strcmp($this->loginStatus, static::DISCONNECTED_STATUS) == 0)
16541653
{
16551654
throw new Exception('Login Failure');

0 commit comments

Comments
 (0)