/** * Authenticate with the Whatsapp Server. * * @return String * Returns binary string */ protected function authenticate() { $keys = KeyStream::GenerateKeys(base64_decode($this->password), $this->challengeData); $this->inputKey = new KeyStream($keys[2], $keys[3]); $this->outputKey = new KeyStream($keys[0], $keys[1]); $phone = $this->dissectPhone(); $array = "" . $this->phoneNumber . $this->challengeData; // . time() . static::WHATSAPP_USER_AGENT . " MccMnc/" . str_pad($phone["mcc"], 3, "0", STR_PAD_LEFT) . "001"; $response = $this->outputKey->EncodeMessage($array, 0, 4, strlen($array) - 4); return $response; }
/** * Authenticate with the WhatsApp Server. * * @return string Returns binary string */ protected function authenticate() { $keys = KeyStream::GenerateKeys(base64_decode($this->password), $this->parent->getChallengeData()); $this->inputKey = new KeyStream($keys[2], $keys[3]); $this->outputKey = new KeyStream($keys[0], $keys[1]); $array = "" . $this->phoneNumber . $this->parent->getChallengeData() . "" . time() . '000' . hex2bin('00') . '000' . hex2bin('00') . Constants::OS_VERSION . hex2bin('00') . Constants::MANUFACTURER . hex2bin('00') . Constants::DEVICE . hex2bin('00') . Constants::BUILD_VERSION; $response = $this->outputKey->EncodeMessage($array, 0, 4, strlen($array) - 4); $this->parent->setOutputKey($this->outputKey); return $response; }
/** * Authenticate with the WhatsApp Server. * * @return string Returns binary string */ protected function authenticate() { $keys = KeyStream::GenerateKeys(base64_decode($this->password), $this->parent->getChallengeData()); $this->inputKey = new KeyStream($keys[2], $keys[3]); $this->outputKey = new KeyStream($keys[0], $keys[1]); $return = CustGetHex($keys[0]); echo "{$return} \n"; $return = CustGetHex($keys[1]); echo "{$return} \n"; $return = CustGetHex($keys[2]); echo "{$return} \n"; $return = CustGetHex($keys[3]); echo "{$return} \n"; $ttt = time(); file_put_contents(__DIR__ . '/log.txt', $ttt . "\n", FILE_APPEND); $chd = $this->parent->getChallengeData(); $return = CustGetHex($chd); file_put_contents(__DIR__ . '/log.txt', $return . "\n", FILE_APPEND); $array = "" . $this->phoneNumber . $this->parent->getChallengeData() . '' . time() . '000' . hex2bin('00') . '000' . hex2bin('00') . Constants::OS_VERSION . hex2bin('00') . Constants::MANUFACTURER . hex2bin('00') . Constants::DEVICE . hex2bin('00') . Constants::BUILD_VERSION; $return = CustGetHex($array); file_put_contents(__DIR__ . '/log.txt', $return . "\n", FILE_APPEND); $response = $this->outputKey->EncodeMessage($array, 0, 4, strlen($array) - 4); $this->parent->setOutputKey($this->outputKey); $return = CustGetHex($response); file_put_contents(__DIR__ . '/log.txt', $return . "\n", FILE_APPEND); return $response; }
<?php require_once __DIR__ . '/../src/keystream.class.php'; $password = '******'; $enc = base64_decode($password); PrintHex($enc); echo "{$enc} \n"; //$challengeData = array(0xf7, 0xe2, 0x86, 0xd2, 0x1c, 0xda, 0x51, 0x2c, 0xef, 0x9b, 0x65, 0xb8, 0xd2, 0x69, 0x20, 0xf9, 0x3c, 0x5d, 0x64, 0x87); $challengeData = array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); $challengeData = 'bbbbbbbb'; //file_put_contents(__DIR__.'/filename.txt', print_r(mb_list_encodings(), true)); $keys = KeyStream::GenerateKeys($enc, $challengeData); PrintHex($keys[0]); PrintHex($keys[1]); PrintHex($keys[2]); PrintHex($keys[3]); function PrintHex($from) { $return = ""; for ($i = 0; $i < strlen($from); $i++) { $return .= ' ' . bin2hex(substr($from, $i, 1)); } echo "{$return} \n"; }
/** * Authenticate with the WhatsApp Server. * * @return string Returns binary string */ protected function authenticate() { $keys = KeyStream::GenerateKeys(base64_decode($this->password), $this->challenge_data); $this->input_key = new KeyStream($keys[2], $keys[3]); $this->output_key = new KeyStream($keys[0], $keys[1]); $array = "" . $this->phone_number . $this->challenge_data; $response = $this->output_key->EncodeMessage($array, 0, 4, strlen($array) - 4); return $response; }
require_once __DIR__ . '/../src/keystream.class.php'; require_once __DIR__ . '/../src/Constants.php'; require_once __DIR__ . '/../src/protocol.class.php'; require_once __DIR__ . '/../src/BinTreeNodeWriter.php'; require_once __DIR__ . '/../src/tokenmap.class.php'; $password = '******'; $ChallengeData0 = 'a'; $challengeFilename = __DIR__ . '/nextChallenge.79250069542.dat'; if (is_readable($challengeFilename)) { $ChallengeData1 = file_get_contents($challengeFilename); } $ChallengeData2 = hex2bin("f1288b84cfcadabb72d9de9503ad0471591a89bd"); $ChallengeData = hex2bin("f673553e6eca565fab2c13f5e476ce44daa135c3"); // $key = 'a'; // $outputKey = new KeyStream($key, 'a'); $keys = KeyStream::GenerateKeys(base64_decode($password), $ChallengeData); PrintHex($ChallengeData); echo "{$ChallengeData} \n"; PrintHex($keys[0]); PrintHex($keys[1]); PrintHex($keys[2]); PrintHex($keys[3]); function PrintHex($from) { $return = ""; for ($i = 0; $i < strlen($from); $i++) { $return .= ' ' . bin2hex(substr($from, $i, 1)); } echo "{$return} \n"; // file_put_contents(__DIR__.'/log.txt', $return."\n", FILE_APPEND); }