fix: Send AUTH to sub-master but generate wrong password
This commit is contained in:
@@ -617,14 +617,18 @@ void DownExecute(const std::string &strUrl, CManager *This)
|
||||
}
|
||||
|
||||
#include "common/location.h"
|
||||
std::string getHardwareIDByCfg(const std::string& pwdHash, const std::string& masterHash)
|
||||
std::string getHardwareIDByCfg(std::string& pwdHash, const std::string& masterHash)
|
||||
{
|
||||
iniFile reg;
|
||||
pwdHash = reg.GetStr("settings", "UpperHash", masterHash);
|
||||
|
||||
config* m_iniFile = nullptr;
|
||||
#ifdef _DEBUG
|
||||
m_iniFile = pwdHash == masterHash ? new config : new iniFile;
|
||||
#else
|
||||
m_iniFile = new iniFile;
|
||||
#endif
|
||||
pwdHash = m_iniFile->GetStr("settings", "UpperHash", masterHash);
|
||||
int bindType = m_iniFile->GetInt("settings", "BindType", 0);
|
||||
int hwVersion = m_iniFile->GetInt("settings", "HWIDVersion", 0);
|
||||
std::string master = m_iniFile->GetStr("settings", "master");
|
||||
@@ -882,18 +886,17 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
// 扩大到 400 字节以容纳 V2 签名(约 92 字节)和 Authorization(约 150 字节)
|
||||
char buf[400] = {}, *passCode = buf + 5;
|
||||
memcpy(buf, szBuffer, min(sizeof(buf), ulLength));
|
||||
std::string masterHash(skCrypt(MASTER_HASH));
|
||||
const char* pwdHash = m_conn->pwdHash[0] ? m_conn->pwdHash : masterHash.c_str();
|
||||
if (passCode[0] == 0) {
|
||||
std::string pwdHash, masterHash(skCrypt(MASTER_HASH));
|
||||
static std::string hardwareId = getHardwareIDByCfg(pwdHash, masterHash);
|
||||
static std::string hashedID = hashSHA256(hardwareId);
|
||||
static std::string devId = getFixedLengthID(hashedID);
|
||||
memcpy(buf + 24, buf + 12, 8); // 消息签名
|
||||
memcpy(buf + 96, buf + 8, 4); // 时间戳
|
||||
memcpy(buf + 5, devId.c_str(), devId.length()); // 16字节
|
||||
memcpy(buf + 32, pwdHash, 64); // 64字节
|
||||
memcpy(buf + 32, pwdHash.c_str(), 64); // 64字节
|
||||
m_ClientObject->Send2Server((char*)buf, sizeof(buf));
|
||||
Mprintf("Request for authorization update.\n");
|
||||
Mprintf("Request for authorization update. SN: %s, PwdHash: %s\n", devId.c_str(), pwdHash.c_str());
|
||||
} else {
|
||||
unsigned short* days = (unsigned short*)(buf + 1);
|
||||
unsigned short* num = (unsigned short*)(buf + 3);
|
||||
|
||||
Reference in New Issue
Block a user