public function __construct() { $this->classInfo = new \wechat\PBClassInfo(); $this->classInfo->nameProperty[] = 'baseRequest'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0x1, 0x2, 0xB, 0x0, 0x0, 'BaseRequest'); $this->classInfo->nameProperty[] = 'userName'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0x2, 0x1, 0x9, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'mobile'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0x3, 0x1, 0x9, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'opcode'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0x4, 0x2, 0x5, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'verifycode'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0x5, 0x1, 0x9, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'dialFlag'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0x6, 0x1, 0x5, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'dialLang'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0x7, 0x1, 0x9, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'authTicket'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0x8, 0x1, 0x9, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'forceReg'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0x9, 0x1, 0xD, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'safeDeviceName'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0xA, 0x1, 0x9, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'safeDeviceType'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0xB, 0x1, 0x9, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'randomEncryKey'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0xC, 0x1, 0xB, 0x0, 0x0, 'SKBuiltinBuffer_t'); $this->classInfo->nameProperty[] = 'language'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0xD, 0x1, 0x9, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'inputMobileRetrys'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0xE, 0x1, 0xD, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'adjustRet'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0xF, 0x1, 0xD, 0x0, 0x0, ''); $this->classInfo->nameProperty[] = 'clientSeqId'; $this->classInfo->objectDefinition[] = new \wechat\ObjectDefinition(0x10, 0x1, 0x9, 0x0, 0x0, ''); parent::__construct(); }
$FieldTypeDictionary = array(-1, 1, 5, 0, 0, 0, 1, 5, 0, 2, 3, 2, 2, 0, 0, 5, 1, 0, 0); $fieldType = $FieldTypeDictionary[$fieldType]; $tag = $fieldNumber << 3 | $fieldType;
public function getVerifyCode() { $bindOpMobileRequest = new \wechat\Request\BindOpMobileRequest(); $baseRequest = $this->createBaseRequest(); $this->aesKey = random_bytes(0x10); $baseRequest->sessionKey = ''; $baseRequest->scene = 0; $bindOpMobileRequest->baseRequest = $baseRequest; $bindOpMobileRequest->mobile = $this->phoneNumber; $bindOpMobileRequest->opcode = 14; $bindOpMobileRequest->safeDeviceName = $this->deviceName; $bindOpMobileRequest->safeDeviceType = 'iPhone'; $bindOpMobileRequest->randomEncryKey = new \wechat\Object\SKBuiltinBuffer_t(); $bindOpMobileRequest->randomEncryKey->iLen = strlen($this->aesKey); $bindOpMobileRequest->randomEncryKey->buffer = $this->aesKey; $bindOpMobileRequest->language = $this->language; $bindOpMobileRequest->inputMobileRetrys = 5; $bindOpMobileRequest->adjustRet = 0; $bindOpMobileRequest->clientSeqId = $this->clientSeqId; $serializedData = $bindOpMobileRequest->serializedData(); }
$header = $this->computeHeader($serializedData, 0x91, 2); $dataToSend = $header . $this->client->RSAEncrypt($serializedData); $response = $this->client->request($this, $dataToSend, 'bindopmobileforreg');
$response = deleteHeaderFromResponse($response); $response = $this->client->AESDecrypt($response, $this->aesKey); $bindOpMobileResponse = new \wechat\Response\BindOpMobileResponse(); $bindOpMobileResponse->mergeFromData($response);
Source: https://habr.com/ru/post/339772/
All Articles