This commit is contained in:
lenheart
2024-09-15 13:08:42 +08:00
parent 977fdf7ccf
commit b90bde86e0
26 changed files with 948 additions and 210 deletions

View File

@@ -372,7 +372,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
{ // gets the fie123oo' from the global table
sq_pushroottable(v); // push the 'this' (in this case is the global table)
sq_pushuserpointer(v, user);
sq_call(v, 2, SQTrue, SQFalse); // calls the function
sq_call(v, 2, SQFalse, SQTrue); // calls the function
}
sq_settop(v, top); // restores the original stack size
return Ret;
@@ -390,7 +390,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
{ // gets the fie123oo' from the global table
sq_pushroottable(v); // push the 'this' (in this case is the global table)
sq_pushuserpointer(v, user);
sq_call(v, 2, SQTrue, SQFalse); // calls the function
sq_call(v, 2, SQFalse, SQTrue); // calls the function
}
sq_settop(v, top); // restores the original stack size
return Ret;
@@ -408,7 +408,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
{ // gets the fie123oo' from the global table
sq_pushroottable(v); // push the 'this' (in this case is the global table)
sq_pushuserpointer(v, user);
sq_call(v, 2, SQTrue, SQFalse); // calls the function
sq_call(v, 2, SQFalse, SQTrue); // calls the function
}
sq_settop(v, top); // restores the original stack size
return Ret;
@@ -426,7 +426,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
{ // gets the fie123oo' from the global table
sq_pushroottable(v); // push the 'this' (in this case is the global table)
sq_pushuserpointer(v, user);
sq_call(v, 2, SQTrue, SQFalse); // calls the function
sq_call(v, 2, SQFalse, SQTrue); // calls the function
}
sq_settop(v, top); // restores the original stack size
return Ret;
@@ -451,19 +451,19 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
// 查看信息
else if (packet_id == 8)
{
// std::cout << "查看信息" << std::endl;
// std::lock_guard<std::recursive_mutex> lock(SqMtx);
// // 执行虚拟机Main函数
// SQInteger top = sq_gettop(v); // saves the stack size before the call
// sq_pushroottable(v); // pushes the global table
// sq_pushstring(v, _SC("Cb_player_exit"), -1);
// if (SQ_SUCCEEDED(sq_get(v, -2)))
// { // gets the fie123oo' from the global table
// sq_pushroottable(v); // push the 'this' (in this case is the global table)
// sq_pushuserpointer(v, user);
// sq_call(v, 2, SQFalse, SQTrue); // calls the function
// }
// sq_settop(v, top); // restores the original stack size
std::lock_guard<std::recursive_mutex> lock(SqMtx);
// 执行虚拟机Main函数
SQInteger top = sq_gettop(v); // saves the stack size before the call
sq_pushroottable(v); // pushes the global table
sq_pushstring(v, _SC("Cb_see_information"), -1);
if (SQ_SUCCEEDED(sq_get(v, -2)))
{ // gets the fie123oo' from the global table
sq_pushroottable(v); // push the 'this' (in this case is the global table)
sq_pushuserpointer(v, user);
sq_pushuserpointer(v, packet_src);
sq_call(v, 3, SQFalse, SQTrue); // calls the function
}
sq_settop(v, top); // restores the original stack size
}
// 自定义包
else if (packet_id == 130)

View File

@@ -3,6 +3,7 @@
#include "l_socket.h"
#include "controller.h"
#include "CConnectPool.h"
#include "Hook_1.hpp"
extern HSQUIRRELVM v;
extern std::recursive_mutex SqMtx;
#define MY_VERSION ("BuildTime " __DATE__ " " __TIME__)
@@ -596,11 +597,24 @@ void PrintAuroraTag()
int _Inter_LoadGeolocation_dispatch_sig(void *pThis, void *pUser, char *a3)
{
PrintAuroraTag();
// 请求脚本
// ReqScript();
// 初始化松鼠
InitSquirrel();
// PrintAuroraTag();
// // 请求脚本
// // ReqScript();
// // 初始化松鼠
// InitSquirrel();
std::lock_guard<std::recursive_mutex> lock(SqMtx);
// 执行虚拟机Main函数
SQInteger top = sq_gettop(v); // saves the stack size before the call
sq_pushroottable(v); // pushes the global table
sq_pushstring(v, _SC("main"), -1);
if (SQ_SUCCEEDED(sq_get(v, -2)))
{ // gets the field 'foo' from the global table
sq_pushroottable(v); // push the 'this' (in this case is the global table)
sq_call(v, 1, SQFalse, SQTrue); // calls the function
}
sq_settop(v, top); // restores the original stack size
int Ret = Inter_LoadGeolocation_dispatch_sig(pThis, pUser, a3);
return Ret;
@@ -805,10 +819,26 @@ void Lenheart()
if (!checkGame("df_game_r"))
{
// 初始化松鼠
InitSquirrel();
// 执行虚拟机Main函数
SQInteger top = sq_gettop(v); // saves the stack size before the call
SQInteger MaxLevel = 70;
sq_pushroottable(v); // pushes the global table
sq_pushstring(v, _SC("Cb_get_ServerMaxLevel"), -1);
if (SQ_SUCCEEDED(sq_get(v, -2)))
{ // gets the fie123oo' from the global table
sq_pushroottable(v); // push the 'this' (in this case is the global table)
sq_call(v, 1, SQTrue, SQTrue); // calls the function
sq_getinteger(v, -1, &MaxLevel);
}
sq_settop(v, top); // restores the original stack size
int a = 1;
void *buf = malloc(4);
CMem::WriteBytes(buf, &a, 4);
unsigned int nMaxGrade = 95;
unsigned int nMaxGrade = MaxLevel;
bGMMode = 1;
// max_level = nMaxGrade;
@@ -846,8 +876,8 @@ void Lenheart()
CMem::WriteUChar(MAIN_OFFSET(0x66521D), nMaxGrade);
CMem::WriteUChar(MAIN_OFFSET(0x665223), nMaxGrade);
if (nMaxGrade > 70)
{
// if (nMaxGrade > 70)
// {
// 以下需要扩充类大小, 修改偏移
CMem::WriteUInt(MAIN_OFFSET(0x87162 + 3), 0xB678 + nMaxGrade * 4 + nMaxGrade * 12);
// CDataManager::set_reward_sp
@@ -858,7 +888,7 @@ void Lenheart()
// CDataManager::GetSpAtLevelUp
CMem::WriteUChar(MAIN_OFFSET(0x318CC4), nMaxGrade);
CMem::WriteUInt(MAIN_OFFSET(0x318CD4 + 2), 10836 + 840);
}
// }
CMem::WriteUChar(MAIN_OFFSET(0x61B8F6), nMaxGrade);
CMem::WriteUChar(MAIN_OFFSET(0x622659), nMaxGrade);
CMem::WriteUChar(MAIN_OFFSET(0x622941), nMaxGrade);
@@ -902,7 +932,8 @@ void Lenheart()
SUBHOOK_SETUP(Giveup_Game);
// 用户每五分钟执行
SUBHOOK_SETUP(CUserWorkPerFiveMin);
OpenHook1();
// SUBHOOK_SETUP(cusermake_basic_info);
// 每帧执行
@@ -919,13 +950,14 @@ void Lenheart()
Controller::Get()
->init();
// SUBHOOK_SETUP(isSocketAvatar);
void *handle = dlopen("/home/neople/game/frida.so", RTLD_LAZY);
if (handle)
{
std::cerr << "已加载库: Frida" << '\n';
}
// void *handle = dlopen("/home/neople/game/frida.so", RTLD_LAZY);
// if (handle)
// {
// std::cerr << "已加载库: Frida" << '\n';
// }
}
}

View File

@@ -187,8 +187,7 @@ static SQInteger SqReloadScript(HSQUIRRELVM v)
void InitSquirrel()
{
std::lock_guard<std::recursive_mutex>
lock(SqMtx);
// std::lock_guard<std::recursive_mutex> lock(SqMtx);
v = sq_open(4096); // 创建虚拟机其栈的初始大小为1024
@@ -228,17 +227,6 @@ void InitSquirrel()
ReqSquirrelScript(v);
}
// 执行虚拟机Main函数
SQInteger top = sq_gettop(v); // saves the stack size before the call
sq_pushroottable(v); // pushes the global table
sq_pushstring(v, _SC("main"), -1);
if (SQ_SUCCEEDED(sq_get(v, -2)))
{ // gets the field 'foo' from the global table
sq_pushroottable(v); // push the 'this' (in this case is the global table)
sq_call(v, 1, SQFalse, SQTrue); // calls the function
}
sq_settop(v, top); // restores the original stack size
sq_pushroottable(v);
sq_pushstring(v, "sq_ReloadScript", -1);
sq_newclosure(v, SqReloadScript, 0); // create a new function