This commit is contained in:
Lenheart 2022-05-23 21:37:38 +08:00
parent a0f64376e9
commit 516b9b993d
5 changed files with 78 additions and 56 deletions

View File

@ -41,29 +41,34 @@ void LenheartThread(void)
#else #else
void LenheartThread() 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) while (true)
{ {
Sleep(10); static int ;
if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 6) = 1; if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 6) = 1;
if ( == 1) if ( == 1)
{ {
std::string ippack; Sleep(3000);
int gameip = *(int*)0x1AE9CEC; //获取验证服务器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) if (gameip == 3735601)
{ {
ippack = MyIp; ippack = MyIp;
@ -73,6 +78,8 @@ void LenheartThread()
wchar_t* wgameip = (wchar_t*)0x1AE9CEC; wchar_t* wgameip = (wchar_t*)0x1AE9CEC;
DNFTOOL::Wchar_tToString(ippack, wgameip); DNFTOOL::Wchar_tToString(ippack, wgameip);
} }
//std::cout << "验证IP:" << ippack << std::endl;
//已经获取了要发送的验证IP
LenheartBase::CBASE64 bb; LenheartBase::CBASE64 bb;
@ -81,7 +88,6 @@ void LenheartThread()
std::string enstring = bb.encode(rsastring); std::string enstring = bb.encode(rsastring);
httplib::Client* CliObj = NULL;// http连接主体 httplib::Client* CliObj = NULL;// http连接主体
CliObj = new httplib::Client(Rqip + ":9007");//初始化 http 对象 CliObj = new httplib::Client(Rqip + ":9007");//初始化 http 对象
@ -91,7 +97,6 @@ void LenheartThread()
if (res->status == 200)//如果返回包正常 if (res->status == 200)//如果返回包正常
{ {
//res->status;
std::string date = res->body;//取得date std::string date = res->body;//取得date
std::string base64code = bb.decode(date); std::string base64code = bb.decode(date);
std::string decrypt_text = bb.RsaPriDecrypt(base64code, Pri_key); std::string decrypt_text = bb.RsaPriDecrypt(base64code, Pri_key);
@ -103,25 +108,19 @@ void LenheartThread()
__int64 absnum = abs(nowdate - redate); __int64 absnum = abs(nowdate - redate);
if (absnum < 18000) if (absnum < 18000)
{ {
//RegisterNut();
//RunNut();
hook::InitGameScript(); hook::InitGameScript();
while (true) return;
{
Sleep(16000);
}
} }
else else
{ {
ExitProcess(0); //ExitProcess(0);
break;
} }
} }
else else
{ {
ExitProcess(0); //ExitProcess(0);
break;
} }
return;
} }
} }
} }

View File

@ -26,7 +26,7 @@
#define LOCALHOSTS_SWITCH "本地免验证 开启" //#define LOCALHOSTS_SWITCH "本地免验证 开启"
#define COUTWINDOWS_SWITCH "输出窗口 开启" #define COUTWINDOWS_SWITCH "输出窗口 开启"
@ -59,7 +59,7 @@
#else #else
#define CPPHTTPLIB_OPENSSL_SUPPORT #define CPPHTTPLIB_OPENSSL_SUPPORT
#include "framework.h" //#include "framework.h"
#include "RSAC.h" #include "RSAC.h"
#include "BASE64.h" #include "BASE64.h"
#include "httplib.h" #include "httplib.h"

View File

@ -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) void _fastcall hook::H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4, int a5, int a6)
{ {
//ÇëÎđÉžłý
if (a3 == 9999 && a4 == 9999) if (a3 == 9999 && a4 == 9999)
{ {
for (DrawCodestruct iter : DrawCodeT1_STL) 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(); DrawCodeT1_STL.clear();
} }
//ĚŘĘâ
if (a3 == 9999 && a4 == 9998) 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(); 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); return DrawCodeF(thisc, Seat, a3, a4, a5, a6);
} }
int hook::RegisterHook() int hook::RegisterHook()
{ {
MH_Initialize(); MH_Initialize();
//HookÊÕ°ü //HookÊÕ°ü
MH_CreateHook((void*)INIT_PACK_ADDRESS, &H_Register_Pack, reinterpret_cast<void**>(&Lpfn_Init)); MH_CreateHook((void*)INIT_PACK_ADDRESS, &H_Register_Pack, reinterpret_cast<void**>(&Lpfn_Init));
@ -73,10 +86,10 @@ int hook::RegisterHook()
MH_CreateHook((void*)INIT_NUT_DRAWCODE, &H_Register_DrawCode, reinterpret_cast<void**>(&DrawCodeF)); MH_CreateHook((void*)INIT_NUT_DRAWCODE, &H_Register_DrawCode, reinterpret_cast<void**>(&DrawCodeF));
MH_EnableHook((void*)INIT_PACK_ADDRESS); MH_EnableHook((void*)INIT_PACK_ADDRESS);
MH_EnableHook((void*)INIT_NUT_ADDRESS); MH_EnableHook((void*)INIT_NUT_ADDRESS);
MH_EnableHook((void*)INIT_NUT_DRAWCODE); MH_EnableHook((void*)INIT_NUT_DRAWCODE);
return 0; return 0;
} }

View File

@ -18,12 +18,12 @@ void sock::Pack_Control(int idx, int code, void* p3, void* p4)
//질분 //질분
#if defined DRAGONBOX_SWITCH #if defined DRAGONBOX_SWITCH
if (Op >= 0 && Op < 10)Json_STL["DragonBox"] = Buffer; if (Op >= 0 && Op <= 10)Json_STL["DragonBox"] = Buffer;
#endif #endif
//各썹Boss //各썹Boss
#if defined WORLDBOSS_SWITCH #if defined WORLDBOSS_SWITCH
if (Op >= 10 && Op < 20)Json_STL["WorldBoss"] = Buffer; if (Op >= 10 && Op <= 20)Json_STL["WorldBoss"] = Buffer;
#endif #endif

View File

@ -1140,7 +1140,7 @@ int squirrel::Jsoner_STL(uint32_t v)
} }
} }
break; break;
case OT_STRING: case OT_STRING://StringÀàÐÍ
{ {
if (Json_STL.count(Name) == 0)//Èç¹ûÕâ¸öhash²»´æÔÚ ¾Í·µ»Ø if (Json_STL.count(Name) == 0)//Èç¹ûÕâ¸öhash²»´æÔÚ ¾Í·µ»Ø
@ -1159,7 +1159,6 @@ int squirrel::Jsoner_STL(uint32_t v)
std::vector<std::string> Data; std::vector<std::string> Data;
DNFTOOL::Split(key, Data); DNFTOOL::Split(key, Data);
rapidjson::Value Vbuffer; rapidjson::Value Vbuffer;
for (int i = 0; i < Data.size(); i++) for (int i = 0; i < Data.size(); i++)
{ {
if (i == 0) if (i == 0)
@ -1168,33 +1167,44 @@ int squirrel::Jsoner_STL(uint32_t v)
} }
else if (DNFTOOL::isNum(Data[i].c_str()) != 0) 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 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()); if (Vbuffer.IsString())
SQPushString(v, buffer, wcslen(buffer)); {
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; break;
} }