This commit is contained in:
lenheart
2025-02-20 18:25:03 +08:00
parent 85375acd80
commit 21f64fbd9e
103 changed files with 6531 additions and 5980 deletions

View File

@@ -30,8 +30,6 @@ add_compile_definitions(ASMJIT_STATIC)
# <20><><EFBFBD>ӿ<EFBFBD>Դ<EFBFBD>ļ<EFBFBD>
set(LIB_SOURCE
"dispatch.cpp"
"controller.cpp"
"df_main.cpp"
"Tool.cpp"
"l_squirrel.cpp"
@@ -49,6 +47,7 @@ SET_TARGET_PROPERTIES(hook_aurora PROPERTIES OUTPUT_NAME "Aurora")
target_link_libraries(hook_aurora libstdc++.a -L/home/squirrel-master/squirrel-master/build/lib -lsqstdlib_static -L/home/squirrel-master/squirrel-master/build/lib -lsquirrel_static -L/home/dnf_project/dnf_project/build/lib/mysql/lib libmysqlclient.a -lpthread -L/home/openssl/openssl-3.0.13 libssl.a -L/home/openssl/openssl-3.0.13 libcrypto.a -L/home/dnf_project/dnf_project/build/lib/frida libfrida-gum.a -ldl -pthread -lresolv libffi.a -L/home/opencc/build/src libopencc.a)
# target_link_libraries(hook_aurora /usr/local/lib/libffi.a)
# ָ<><D6B8><EFBFBD><EFBFBD>̬<EFBFBD><CCAC>汾, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD>
# VERSION:<3A><>̬<EFBFBD><CCAC><EFBFBD><E6B1BE>SOVERSION:API<50>

View File

@@ -21,7 +21,7 @@ struct CeraShopBonusItemType
class CGameDataManager
{
public:
SINGLETON_DEFINE_S(CGameDataManager);
RINDRO_SINGLETON_DEFINE_S(CGameDataManager);
CGameDataManager()
{

View File

@@ -23,10 +23,10 @@ Controller::~Controller()
void Controller::init()
{
HOOK_SETUP(PacketDispatcher_doDispatch);
// HOOK_SETUP(PacketDispatcher_doDispatchRindro);
}
int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *user, int packet_class, int packet_id, char *packet_src, int packet_len, int a7, int a8)
int Controller::hook_PacketDispatcher_doDispatchRindro(PacketDispatcher *a1, CUser *user, int packet_class, int packet_id, char *packet_src, int packet_len, int a7, int a8)
{
// 区域移动
@@ -135,7 +135,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
// 更换装备
else if (packet_id == 19)
{
int Ret = Get()->old_PacketDispatcher_doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
int Ret = Get()->old_PacketDispatcher_doDispatchRindro(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
std::lock_guard<std::recursive_mutex> lock(SqMtx);
// 执行虚拟机Main函数
SQInteger top = sq_gettop(v); // saves the stack size before the call
@@ -174,7 +174,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
// 组队 同意组队和同意加入
else if (packet_id == 11)
{
int Ret = Get()->old_PacketDispatcher_doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
int Ret = Get()->old_PacketDispatcher_doDispatchRindro(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
std::lock_guard<std::recursive_mutex> lock(SqMtx);
// 执行虚拟机Main函数
SQInteger top = sq_gettop(v); // saves the stack size before the call
@@ -192,7 +192,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
// 组队 退出队伍
else if (packet_id == 13)
{
int Ret = Get()->old_PacketDispatcher_doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
int Ret = Get()->old_PacketDispatcher_doDispatchRindro(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
std::lock_guard<std::recursive_mutex> lock(SqMtx);
// 执行虚拟机Main函数
SQInteger top = sq_gettop(v); // saves the stack size before the call
@@ -210,7 +210,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
// 组队 踢出队伍
else if (packet_id == 14)
{
int Ret = Get()->old_PacketDispatcher_doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
int Ret = Get()->old_PacketDispatcher_doDispatchRindro(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
std::lock_guard<std::recursive_mutex> lock(SqMtx);
// 执行虚拟机Main函数
SQInteger top = sq_gettop(v); // saves the stack size before the call
@@ -228,7 +228,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
// 组队 委任队长
else if (packet_id == 124)
{
int Ret = Get()->old_PacketDispatcher_doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
int Ret = Get()->old_PacketDispatcher_doDispatchRindro(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
std::lock_guard<std::recursive_mutex> lock(SqMtx);
// 执行虚拟机Main函数
SQInteger top = sq_gettop(v); // saves the stack size before the call
@@ -295,5 +295,5 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
}
sq_settop(v, top); // restores the original stack size
}
return Get()->old_PacketDispatcher_doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
// return Get()->old_PacketDispatcher_doDispatchRindro(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
}

View File

@@ -20,7 +20,7 @@
class Controller
{
public:
SINGLETON_DEFINE_S(Controller);
RINDRO_SINGLETON_DEFINE_S(Controller);
private:
Controller();
@@ -56,7 +56,7 @@ private:
* @param a8
* @return
*/
static int hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *a2, int a3, int packet_id, char *packet_src, int pecakt_len, int a7, int a8);
static int hook_PacketDispatcher_doDispatchRindro(PacketDispatcher *a1, CUser *a2, int a3, int packet_id, char *packet_src, int pecakt_len, int a7, int a8);
static int hook_LenDispatcher_New_Gmdebug_Command(void *a1, void *pUser, void *pBuf);
@@ -76,7 +76,7 @@ private:
private:
INIT_HOOK(IPacketDispatcher_ParamBase_dispatch_template, base::IPacketDispatcher::ParamBase::dispatch_template);
INIT_HOOK(PacketDispatcher_doDispatch, base::PacketDispatcher::doDispatch);
INIT_HOOK(PacketDispatcher_doDispatchRindro, base::PacketDispatcher::doDispatch);
INIT_HOOK(Dispatcher_ModItemAttr_dispatch_sig, base::Dispatcher_ModItemAttr::dispatch_sig);
INIT_HOOK(UseJewel_dispatch_sig, base::Dispatcher_UseJewel::dispatch_sig);
INIT_HOOK(DisPatcher_MoveMap_dispatch_sig, base::DisPatcher_MoveMap::dispatch_sig);

View File

@@ -350,18 +350,275 @@ int my_usleep(__useconds_t __useconds)
return malloc(__size);
}*/
int _doDispatch(void *pPacketDispatcher, void *pUser, int a3, int a4, void *src, int a6, int a7, int a8) // 收包处理
int _doDispatch(PacketDispatcher *a1, CUser *user, int packet_class, int packet_id, char *packet_src, int packet_len, int a7, int a8) // 收包处理
{
void *pAction = *get_dispatcher(pPacketDispatcher, a4);
if (pAction)
// 区域移动
if (packet_id == 38)
{
// printf("Recv() cs:%d cmd:%d len:%d callback:%p\t%p\t%p\t%p\t%p\t%p\n", a3, a4, a6, *((void **)pAction), (void *)*((unsigned int *)pAction + 12), (void *)*((unsigned int *)pAction + 16), (void *)*((unsigned int *)pAction + 20), (void *)*((unsigned int *)pAction + 24), (void *)*((unsigned int *)pAction + 28));
std::lock_guard<std::recursive_mutex> lock(SqMtx);
SQBool R;
// 执行虚拟机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_move_area"), -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_pushinteger(v, int(*(unsigned char *)(packet_src + 0x0D)));
sq_pushinteger(v, int(*(unsigned char *)(packet_src + 0x0E)));
sq_call(v, 4, SQTrue, SQTrue); // calls the function
sq_getbool(v, -1, &R);
}
sq_settop(v, top); // restores the original stack size
if (!R)
return 0;
}
else
// 普通输入
// else if (packet_id == 17)
// {
// std::string str = Utils::PackToHexString((const unsigned char *)packet_src, 20);
// str += ("RindroType");
// str += std::to_string((int)(*(unsigned char *)(packet_src + 0x0d)));
// std::lock_guard<std::recursive_mutex> lock(SqMtx);
// SQBool R;
// // 执行虚拟机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_base_input"), -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_pushstring(v, _SC((str).c_str()), -1);
// sq_call(v, 3, SQTrue, SQTrue); // calls the function
// sq_getbool(v, -1, &R);
// }
// sq_settop(v, top); // restores the original stack size
// if (!R)
// return 0;
// }
// GM输入
else if (packet_id == 179)
{
// printf("Recv() cs:%d cmd:%d len:%d\n", a3, a4, a6);
// std::cout << "传入的: " << std::hex << (int)user << std::endl;
std::string str = Utils::PackToHexString((const unsigned char *)packet_src, 13);
str = str.substr(2);
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_gm_input"), -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_pushstring(v, _SC(str.c_str()), -1);
sq_call(v, 3, SQFalse, SQTrue); // calls the function
}
sq_settop(v, top); // restores the original stack size
}
return doDispatch(pPacketDispatcher, pUser, a3, a4, src, a6, a7, a8);
// 特殊道具使用
else if (packet_id == 255)
{
std::lock_guard<std::recursive_mutex> lock(SqMtx);
SQBool R = true;
// 执行虚拟机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_use_item_sp"), -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_pushinteger(v, int(*(int *)(packet_src + 0x0D)));
sq_call(v, 3, SQTrue, SQTrue); // calls the function
sq_getbool(v, -1, &R);
}
sq_settop(v, top); // restores the original stack size
if (!R)
return 0;
}
// 返回选择角色
else if (packet_id == 7)
{
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_return_select_character"), -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
}
// 更换装备
else if (packet_id == 19)
{
int Ret = doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
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_chanage_equ"), -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
return Ret;
}
// 组队 创建和加入
else if (packet_id == 10)
{
std::lock_guard<std::recursive_mutex> lock(SqMtx);
SQBool R;
// 执行虚拟机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_userpartycreate"), -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, SQTrue, SQTrue); // calls the function
sq_getbool(v, -1, &R);
}
sq_settop(v, top); // restores the original stack size
if (!R)
return 0;
}
// 组队 同意组队和同意加入
else if (packet_id == 11)
{
int Ret = doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
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_userpartyagree"), -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
return Ret;
}
// 组队 退出队伍
else if (packet_id == 13)
{
int Ret = doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
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_userpartyexit"), -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
return Ret;
}
// 组队 踢出队伍
else if (packet_id == 14)
{
int Ret = doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
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_userpartykick"), -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
return Ret;
}
// 组队 委任队长
else if (packet_id == 124)
{
int Ret = doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
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_userpartygivemaster"), -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
return Ret;
}
// 下线
else if (packet_id == 3)
{
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
}
// 查看信息
else if (packet_id == 8)
{
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)
{
std::string str = Utils::PackToHexString((const unsigned char *)packet_src, 13);
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("OnClientSocketMsg"), -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_pushstring(v, _SC(str.c_str()), -1);
sq_call(v, 3, SQFalse, SQTrue); // calls the function
}
sq_settop(v, top); // restores the original stack size
}
return doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8);
}
int _dispatch_template(void *pInst, void *pUser, void *pPacketBuf)
@@ -959,11 +1216,11 @@ void Lenheart()
// 设置角色等级
// SUBHOOK_SETUP(SetUserMaxLevel);
// SUBHOOK_SETUP(doDispatch); // 收包注册
SUBHOOK_SETUP(doDispatch); // 收包注册
// CMem::HookJmp(0x86c2994, (int)insert_user_send_to_all);
Controller::Get()->init();
// Controller::Get()->init();
// SUBHOOK_SETUP(isSocketAvatar);

View File

@@ -23,7 +23,7 @@ struct USER_DATA
class CDispatch
{
public:
SINGLETON_DEFINE_S(CDispatch);
RINDRO_SINGLETON_DEFINE_S(CDispatch);
CDispatch();
~CDispatch();
public: