This commit is contained in:
lenheart
2024-06-03 10:57:47 +08:00
parent b6d3556286
commit d02932b717
144 changed files with 32907 additions and 527 deletions

View File

@@ -46,7 +46,7 @@ ADD_LIBRARY(hook_aurora SHARED ${DIR_ASMJIT_LIB_SRCS} ${LIB_SOURCE})
SET_TARGET_PROPERTIES(hook_aurora PROPERTIES OUTPUT_NAME "Aurora")
target_link_libraries(hook_aurora libstdc++.a -L/home/dnf_project/dnf_project/build/lib/squirrel -lsqstdlib_static -L/home/dnf_project/dnf_project/build/lib/squirrel -lsquirrel_static -L/home/dnf_project/dnf_project/build/lib/mysql/lib libmysqlclient.a -lpthread libffi.a)
target_link_libraries(hook_aurora libstdc++.a -L/home/dnf_project/dnf_project/build/lib/squirrel -lsqstdlib_static -L/home/dnf_project/dnf_project/build/lib/squirrel -lsquirrel_static -L/home/dnf_project/dnf_project/build/lib/mysql/lib libmysqlclient.a -lpthread libffi.a -L/home/openssl/openssl-3.0.13 libssl.a -L/home/openssl/openssl-3.0.13 libcrypto.a)
# target_link_libraries(hook_aurora /usr/local/lib/libffi.a)
# 指定动态库版本, 视需求而定,可不加
# VERSION:动态库版本SOVERSION:API版本

View File

@@ -312,6 +312,26 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
}
sq_settop(v, top); // restores the original stack size
}
// 组队
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 == 3)
{
@@ -328,22 +348,6 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher *a1, CUser *us
}
sq_settop(v, top); // restores the original stack size
}
// 放弃副本
else if (packet_id == 45)
{
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_giveup_dgn"), -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 == 130)
{

View File

@@ -43,6 +43,7 @@ SUBHOOK_INIT(CreateEquip, 0x084023AC);
SUBHOOK_INIT(History_Log, 0x854F990);
SUBHOOK_INIT(UseGlod, 0x84FF54C);
SUBHOOK_INIT(BossDieCheckSend, 0x81CDA62);
SUBHOOK_INIT(Giveup_Game, 0x81C40B4);
//_setCharacInfoDetail
@@ -699,6 +700,24 @@ void _BossDieCheckSend(void *a1, void *a2, void *a3)
BossDieCheckSend(a1, a2, a3);
}
void _Giveup_Game(void *CParty, void *CUser, bool a3, bool a4, bool a5)
{
// 放弃副本
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_giveup_dgn"), -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, CUser);
sq_call(v, 2, SQFalse, SQTrue); // calls the function
}
sq_settop(v, top); // restores the original stack size
Giveup_Game(CParty, CUser, a3, a4, a5);
}
void Lenheart()
{
@@ -779,6 +798,8 @@ void Lenheart()
// SUBHOOK_SETUP(UseGlod);
// BOSS死亡
SUBHOOK_SETUP(BossDieCheckSend);
// 放弃副本
SUBHOOK_SETUP(Giveup_Game);
// SUBHOOK_SETUP(doDispatch); // 收包注册

View File

@@ -100,4 +100,7 @@ typedef int (*fnUseGlod)(void *CUser, int a1, int a3, int a4);
// 通过副本
typedef void (*fnBossDieCheckSend)(void *a1, void *a2, void *a3);
// 放弃副本
typedef void (*fnGiveup_Game)(void *CParty, void *CUser, bool a3, bool a4, bool a5);
__END_DECLS

View File

@@ -7,6 +7,8 @@
#include <ctime>
#include <sstream>
#include <chrono>
#include <asio.hpp>
#include <asio/ssl.hpp>
static char szGamePathA[256];
void setupLogger()
@@ -186,6 +188,42 @@ static SQInteger SqReloadScript(HSQUIRRELVM v)
void InitSquirrel()
{
std::cout << "OpenSSL version: " << OPENSSL_VERSION_TEXT << std::endl;
asio::io_context io_context;
asio::ssl::context ctx(asio::ssl::context::tlsv12_client);
asio::ssl::stream<asio::ip::tcp::socket> socket(io_context, ctx);
asio::ip::tcp::resolver resolver(io_context);
auto endpoints = resolver.resolve("www.rindro.cn", "https");
asio::connect(socket.lowest_layer(), endpoints);
socket.handshake(asio::ssl::stream_base::handshake_type::client);
std::string post_data = "key1=value1&key2=value2";
std::string request = "POST /c/user/getServiceUrl HTTP/1.1\r\n";
request += "Host: www.rindro.cn\r\n";
request += "Content-Length: " + std::to_string(post_data.size()) + "\r\n";
request += "Content-Type: application/x-www-form-urlencoded\r\n";
request += "\r\n";
request += post_data;
asio::write(socket, asio::buffer(request));
asio::streambuf response;
asio::read_until(socket, response, "\r\n");
std::istream response_stream(&response);
std::string http_version;
response_stream >> http_version;
std::stringstream ss;
ss << &response;
std::string response_data = ss.str();
std::cout << "Server Response: " << response_data << std::endl;
std::lock_guard<std::recursive_mutex> lock(SqMtx);
v = sq_open(4096); // 创建虚拟机其栈的初始大小为1024