diff --git a/test/dllmain.cpp b/test/dllmain.cpp index 5571f7b..abcb642 100644 --- a/test/dllmain.cpp +++ b/test/dllmain.cpp @@ -41,29 +41,34 @@ void LenheartThread(void) #else void LenheartThread() { - static int 可开始执行判断; - std::string Rqip = DNFTOOL::GetIP(); - - - std::string MyIp; - httplib::Client* IPCliObj = NULL;// http连接主体 - IPCliObj = new httplib::Client("ip.json-json.com");//初始化 http 对象 - auto res = IPCliObj->Get("/"); - if (res->status == 200)//如果返回包正常 - { - MyIp = res->body;//取得date - } - while (true) { - Sleep(10); - + static int 可开始执行判断; if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 6)可开始执行判断 = 1; if (可开始执行判断 == 1) { - std::string ippack; - int gameip = *(int*)0x1AE9CEC; + Sleep(3000); + //获取验证服务器ip + std::string Rqip = DNFTOOL::GetIP(); + //std::cout << "验证服务器IP:" << Rqip << std::endl; + //获取本机IP + std::string MyIp; + httplib::Client* IPCliObj = NULL;// http连接主体 + IPCliObj = new httplib::Client("ip.json-json.com");//初始化 http 对象 + auto MyIpres = IPCliObj->Get("/"); + if (MyIpres->status == 200)//如果返回包正常 + { + MyIp = MyIpres->body;//取得date + } + //std::cout << "本机IP:" << MyIp << std::endl; + //已经得到了本机IP + + //获取验证IP + std::string ippack; + //获取ExeIP + int gameip = *(int*)0x1AE9CEC; + //如果ExeIP 等于 192.168.200.131 if (gameip == 3735601) { ippack = MyIp; @@ -73,6 +78,8 @@ void LenheartThread() wchar_t* wgameip = (wchar_t*)0x1AE9CEC; DNFTOOL::Wchar_tToString(ippack, wgameip); } + //std::cout << "验证IP:" << ippack << std::endl; + //已经获取了要发送的验证IP LenheartBase::CBASE64 bb; @@ -81,7 +88,6 @@ void LenheartThread() std::string enstring = bb.encode(rsastring); - httplib::Client* CliObj = NULL;// http连接主体 CliObj = new httplib::Client(Rqip + ":9007");//初始化 http 对象 @@ -91,7 +97,6 @@ void LenheartThread() if (res->status == 200)//如果返回包正常 { - //res->status; std::string date = res->body;//取得date std::string base64code = bb.decode(date); std::string decrypt_text = bb.RsaPriDecrypt(base64code, Pri_key); @@ -103,25 +108,19 @@ void LenheartThread() __int64 absnum = abs(nowdate - redate); if (absnum < 18000) { - //RegisterNut(); - //RunNut(); hook::InitGameScript(); - while (true) - { - Sleep(16000); - } + return; } else { - ExitProcess(0); - break; + //ExitProcess(0); } } else { - ExitProcess(0); - break; + //ExitProcess(0); } + return; } } } diff --git a/test/framework.h b/test/framework.h index bd9558a..68330bf 100644 --- a/test/framework.h +++ b/test/framework.h @@ -26,7 +26,7 @@ -#define LOCALHOSTS_SWITCH "本地免验证 开启" +//#define LOCALHOSTS_SWITCH "本地免验证 开启" #define COUTWINDOWS_SWITCH "输出窗口 开启" @@ -59,7 +59,7 @@ #else #define CPPHTTPLIB_OPENSSL_SUPPORT -#include "framework.h" +//#include "framework.h" #include "RSAC.h" #include "BASE64.h" #include "httplib.h" diff --git a/test/hook.cpp b/test/hook.cpp index ffa1b17..e1e9920 100644 --- a/test/hook.cpp +++ b/test/hook.cpp @@ -25,7 +25,7 @@ void hook::H_Register_Pack(void* Ecx) void _fastcall hook::H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4, int a5, int a6) { - + //ɾ if (a3 == 9999 && a4 == 9999) { for (DrawCodestruct iter : DrawCodeT1_STL) @@ -35,6 +35,7 @@ void _fastcall hook::H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4, } DrawCodeT1_STL.clear(); } + // if (a3 == 9999 && a4 == 9998) { @@ -54,16 +55,28 @@ void _fastcall hook::H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4, } DrawCodeT2_STL.clear(); } - + //ѡɫ + if (a3 == 9999 && a4 == 9489) + { + uint32_t v = GetSqVm(); + SQPushRootTable(v); + SQPushString(v, L"InitLenheartClass", -1); + SQ_Get(v, -2); + SQPushRootTable(v); + SQPushString(v, L"Lenheart", -1); + SQ_Call(v, 2, 1, 0); + SQPop(v, 2); + } return DrawCodeF(thisc, Seat, a3, a4, a5, a6); } - - int hook::RegisterHook() { + + + MH_Initialize(); //Hookհ MH_CreateHook((void*)INIT_PACK_ADDRESS, &H_Register_Pack, reinterpret_cast(&Lpfn_Init)); @@ -73,10 +86,10 @@ int hook::RegisterHook() MH_CreateHook((void*)INIT_NUT_DRAWCODE, &H_Register_DrawCode, reinterpret_cast(&DrawCodeF)); - MH_EnableHook((void*)INIT_PACK_ADDRESS); MH_EnableHook((void*)INIT_NUT_ADDRESS); MH_EnableHook((void*)INIT_NUT_DRAWCODE); + return 0; } diff --git a/test/sock.cpp b/test/sock.cpp index 53abda7..994a517 100644 --- a/test/sock.cpp +++ b/test/sock.cpp @@ -18,12 +18,12 @@ void sock::Pack_Control(int idx, int code, void* p3, void* p4) // #if defined DRAGONBOX_SWITCH - if (Op >= 0 && Op < 10)Json_STL["DragonBox"] = Buffer; + if (Op >= 0 && Op <= 10)Json_STL["DragonBox"] = Buffer; #endif //Boss #if defined WORLDBOSS_SWITCH - if (Op >= 10 && Op < 20)Json_STL["WorldBoss"] = Buffer; + if (Op >= 10 && Op <= 20)Json_STL["WorldBoss"] = Buffer; #endif diff --git a/test/squirrel.cpp b/test/squirrel.cpp index 0fa2f07..bc72192 100644 --- a/test/squirrel.cpp +++ b/test/squirrel.cpp @@ -1140,7 +1140,7 @@ int squirrel::Jsoner_STL(uint32_t v) } } break; - case OT_STRING: + case OT_STRING://String { if (Json_STL.count(Name) == 0)//hash ͷ @@ -1159,7 +1159,6 @@ int squirrel::Jsoner_STL(uint32_t v) std::vector Data; DNFTOOL::Split(key, Data); rapidjson::Value Vbuffer; - for (int i = 0; i < Data.size(); i++) { if (i == 0) @@ -1168,33 +1167,44 @@ int squirrel::Jsoner_STL(uint32_t v) } else if (DNFTOOL::isNum(Data[i].c_str()) != 0) { - Vbuffer = Vbuffer[atoi(Data[i].c_str())]; + if(Vbuffer.Empty() == 0)Vbuffer = Vbuffer[atoi(Data[i].c_str())]; } else { - Vbuffer = Vbuffer[Data[i].c_str()]; + if (Vbuffer.Empty() == 0)Vbuffer = Vbuffer[Data[i].c_str()]; } } - if (Vbuffer.IsString()) + if (Vbuffer.Empty() == false || (Vbuffer.IsInt() && Vbuffer.GetInt()==0)) { - wchar_t* buffer = DNFTOOL::charTowchar_t((char*)Vbuffer.GetString()); - SQPushString(v, buffer, wcslen(buffer)); + if (Vbuffer.IsString()) + { + wchar_t* buffer = DNFTOOL::charTowchar_t((char*)Vbuffer.GetString()); + SQPushString(v, buffer, wcslen(buffer)); + return 1; + } + if (Vbuffer.IsBool()) + { + SQPushBool(v, Vbuffer.GetBool()); + return 1; + } + if (Vbuffer.IsInt()) + { + SQPushInt(v, Vbuffer.GetInt()); + return 1; + } + if (Vbuffer.IsFloat()) + { + SQPushFloat(v, Vbuffer.GetFloat()); + return 1; + } } - if (Vbuffer.IsBool()) + else { - SQPushBool(v, Vbuffer.GetBool()); + SQPushBool(v, false); + return 1; } - if (Vbuffer.IsInt()) - { - SQPushInt(v, Vbuffer.GetInt()); - } - if (Vbuffer.IsFloat()) - { - SQPushFloat(v, Vbuffer.GetFloat()); - } - return 1; } break; }