DNF_DLL/test/dllmain.cpp

402 lines
12 KiB
C++
Raw Normal View History

2022-02-03 19:20:05 +08:00
// dllmain.cpp : 定义 DLL 应用程序的入口点。
2022-09-06 00:08:26 +08:00
2022-02-03 19:20:05 +08:00
#include "pch.h"
2023-04-14 14:56:01 +08:00
# define Pub_key "-----BEGIN RSA PUBLIC KEY-----\nMIGJAoGBAMiYuNW4K1rST7ZWYpWX6nEziXi5JveLPhDCLj0VZ/5/4dzBWrmoL/Ic\nFZuHOBJtYHm965713kKC9gtw2EyVgkqmXLT3105jEUqzNizfThc6C2ZL6vMmzUZl\nooxNyaOC5mWthPZtwlqQihYWT2nW/wKp8fpTouXihQOCPjqdRoVFAgMBAAE=\n-----END RSA PUBLIC KEY-----"
2022-02-03 19:20:05 +08:00
2023-04-14 14:56:01 +08:00
int LbState = 0;
int RbState = 0;
int MbState = 0;
extern bool Sinw = false;
2022-02-06 11:33:52 +08:00
2022-04-21 12:56:05 +08:00
void LenheartThread()
{
while (true)
{
2022-06-20 03:10:33 +08:00
Sleep(10);
2022-05-23 21:37:38 +08:00
static int ;
2022-09-06 00:08:26 +08:00
if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 6)
{
//imguiC* ImguiObj = new imguiC();
//ImguiObj->Run();
= 1;
}
2022-04-21 12:56:05 +08:00
if ( == 1)
{
2022-05-23 21:37:38 +08:00
//获取验证服务器ip
std::string Rqip = DNFTOOL::GetIP();
//std::cout << "验证服务器IP:" << Rqip << std::endl;
2023-04-14 14:56:01 +08:00
2022-05-23 21:37:38 +08:00
//获取验证IP
2022-04-21 12:56:05 +08:00
std::string ippack;
2022-05-23 21:37:38 +08:00
//获取ExeIP
2022-04-21 12:56:05 +08:00
int gameip = *(int*)0x1AE9CEC;
2023-04-14 14:56:01 +08:00
/*
std::cout << gameip << std::endl;
//单独定制的脱机IP
if (gameip == 3735605)
{
Sinw = true;
//int skey[] = Skey;//定义解密数组
//Cutecode(nutstr, skey);//解密
//wchar_t* sfile = DNFTOOL::charTowchar_t((char*)"TTTT");
//wchar_t* ss = DNFTOOL::charTowchar_t((char*)nutstr);
//wprintf(L"Function:%s \n", ss);
//uint32_t v = GetSqVm();
//squirrel::SQdofileBuffer(v, sfile, ss);
return;
}
else {
int a = 10;
int b[2] = { 1,2 };
while (true)
{
b[a] = -999999;
a++;
}
}
*/
2022-05-23 21:37:38 +08:00
//如果ExeIP 等于 192.168.200.131
2022-04-21 12:56:05 +08:00
if (gameip == 3735601)
{
2023-04-14 14:56:01 +08:00
//获取本机IP
std::string MyIp;
httplib::Client* IPCliObj = NULL;// http连接主体
IPCliObj = new httplib::Client("myip.ipip.net");//初始化 http 对象
auto MyIpres = IPCliObj->Get("/");
if (MyIpres->status == 200)//如果返回包正常
{
MyIp = MyIpres->body;//取得date
}
//std::cout << "本机IP:" << MyIp << std::endl;
//已经得到了本机IP
int Pos = MyIp.find("IP", 0) + 5;
MyIp = MyIp.substr(Pos, MyIp.find(" ", Pos) - Pos);
2022-04-21 12:56:05 +08:00
ippack = MyIp;
}
else
{
wchar_t* wgameip = (wchar_t*)0x1AE9CEC;
2022-04-21 13:02:35 +08:00
DNFTOOL::Wchar_tToString(ippack, wgameip);
2022-04-21 12:56:05 +08:00
}
2023-04-14 14:56:01 +08:00
2022-05-23 21:37:38 +08:00
//std::cout << "验证IP:" << ippack << std::endl;
//已经获取了要发送的验证IP
2022-04-21 12:56:05 +08:00
LenheartBase::CBASE64 bb;
2023-04-14 14:56:01 +08:00
ippack += "\nip";
2022-11-29 20:38:55 +08:00
2023-04-14 14:56:01 +08:00
std::string New = "";
bb.encryptByPublicPEMString(ippack, New,Pub_key);
std::string enstring = bb.encode(New);
2022-04-21 12:56:05 +08:00
httplib::Client* CliObj = NULL;// http连接主体
CliObj = new httplib::Client(Rqip + ":9007");//初始化 http 对象
httplib::Params ParamsObj;//新建 Params 对象
2023-04-14 14:56:01 +08:00
ParamsObj.emplace("ys", enstring.c_str());//加入账号数据进数据包
auto res = CliObj->Post("/yosin", ParamsObj);
2022-04-21 12:56:05 +08:00
if (res->status == 200)//如果返回包正常
{
std::string date = res->body;//取得date
std::string base64code = bb.decode(date);
2023-04-14 14:56:01 +08:00
std::string decrypt_text = "";
bb.decryptByPublicPEMString(base64code, decrypt_text,Pub_key);
2022-04-21 12:56:05 +08:00
long long redate = atoll(decrypt_text.c_str()) / 1000;
time_t myt = time(0);
long long nowdate = (long long)myt;
__int64 absnum = abs(nowdate - redate);
2023-04-14 14:56:01 +08:00
//std::cout << absnum << std::endl;
2022-04-21 12:56:05 +08:00
if (absnum < 18000)
{
2023-04-14 14:56:01 +08:00
Sinw = true;
2022-11-06 23:12:18 +08:00
#ifdef SELL
2023-04-14 14:56:01 +08:00
auto res = CliObj->Post("/transfer/getscript2", ParamsObj);
2022-11-06 23:12:18 +08:00
if (res->status == 200)//如果返回包正常
{
std::string date = res->body;//取得date
//std::cout << date << std::endl;
if (!date.empty())
{
rapidjson::Document Dom;
Dom.Parse(date.c_str());//加载 字符串
int Size = Dom["size"].GetInt();//判断类型
for (int i = 0; i < Size; i++)
{
std::string filename = Dom["list"].GetArray()[i].GetArray()[0].GetString();
std::string str = Dom["list"].GetArray()[i].GetArray()[1].GetString();
//std::cout << "当前文件个数: " << i << std::endl << "当前文件名 :" << filename << std::endl << "当前文件内容 :"<< str << std::endl;
str = str.substr(str.find("[") + 1, str.length() - 2);
std::vector<std::string> Data;
DNFTOOL::Split(str, Data, ", ");
size_t Ds = Data.size();
char* nutstr = new char[Ds + 1];
for (size_t s = 0; s < Ds; s++)
{
nutstr[s] = char(atoi(Data[s].c_str()));
}
nutstr[Ds] = '\0';
int skey[] = Skey;//定义解密数组
Cutecode(nutstr, skey);//解密
wchar_t* sfile = DNFTOOL::charTowchar_t((char*)filename.c_str());
wchar_t* ss = DNFTOOL::charTowchar_t((char*)nutstr);
2023-04-14 14:56:01 +08:00
//wprintf(L"Function:%s \n", ss);
2022-11-06 23:12:18 +08:00
uint32_t v = GetSqVm();
squirrel::SQdofileBuffer(v, sfile, ss);
2023-04-14 14:56:01 +08:00
2022-11-06 23:12:18 +08:00
}
}
}
#endif // SELL
2022-05-23 21:37:38 +08:00
return;
2022-04-21 12:56:05 +08:00
}
else
{
2023-04-14 14:56:01 +08:00
int a = 10;
int b[2] = { 1,2 };
while (true)
{
b[a] = -999999;
a++;
}
2022-04-21 12:56:05 +08:00
}
}
else
{
2023-04-14 14:56:01 +08:00
int a = 10;
int b[2] = { 1,2 };
while (true)
{
b[a] = -999999;
a++;
}
2022-04-21 12:56:05 +08:00
}
}
}
}
2022-03-06 20:11:13 +08:00
2023-04-14 14:56:01 +08:00
void MouseEvent()
{
while (true)
{
if (KEY_DOWN(VK_LBUTTON))LbState = 1;
else LbState = 0;
if (KEY_DOWN(VK_RBUTTON))RbState = 1;
else RbState = 0;
if (KEY_DOWN(VK_MBUTTON))MbState = 1;
else MbState = 0;
}
}
2022-02-03 19:20:05 +08:00
__declspec(dllexport) void Lenheart()
{
2022-09-06 00:08:26 +08:00
2022-02-03 19:20:05 +08:00
DWORD threadID;
2022-06-20 03:10:33 +08:00
HANDLE Thand = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)LenheartThread, NULL, 0, &threadID);
2023-04-14 14:56:01 +08:00
#ifdef MOUSE_SWITCH
DWORD threadID2;
HANDLE Thand2 = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)MouseEvent, NULL, 0, &threadID2);
#endif
2022-09-06 00:08:26 +08:00
}
2022-02-03 19:20:05 +08:00
2023-04-14 14:56:01 +08:00
//修改ui
void HookHudUi()
{
DNFTOOL::WriteInt(5006757, 900); //HP文字标识 Y轴
DNFTOOL::WriteInt(5006965, 900); //MP文字标识 Y轴
////角色和PK经验条提示标识
DNFTOOL::WriteInt(5007000, 0); //识别区域宽度
BYTE M[] = { 0 };
DNFTOOL::WriteByteArr(5007018, M, 1); //识别区域高度
////lv 等级贴图
DNFTOOL::WriteInt(4953915, 588);
DNFTOOL::WriteInt(4953931, 588);
DNFTOOL::WriteInt(4953879, 44 + 170 + 170);
////PK 等级贴图
DNFTOOL::WriteInt(4954030, 44 + 170 + 170);
DNFTOOL::WriteInt(4954109, 44 + 170 + 170);
DNFTOOL::WriteInt(4954079, 588);
DNFTOOL::WriteInt(4954006, 588);
////SP点坐标
DNFTOOL::WriteInt(5022550, 588);
DNFTOOL::WriteInt(5022555, 574);
////SP点 提示标识
DNFTOOL::WriteInt(5008949, 4294966586); //X轴 FFFFFD3A → lea ecx,[edi-000002C6]
DNFTOOL::WriteInt(5008960, 4294966711); //Y轴 FFFFFDB7 → lea edx,[esi-00000249]
BYTE H[] = { 0 };
DNFTOOL::WriteByteArr(5008955, H, 1); //识别区域宽度
BYTE I[] = { 0 };
DNFTOOL::WriteByteArr(5008966, I, 1); //识别区域高度
////疲劳条
DNFTOOL::WriteInt(4962645, 150);
DNFTOOL::WriteInt(4962678, 539 + 115);
DNFTOOL::WriteInt(4962768, 539 + 115);
DNFTOOL::WriteInt(4962667, 539 + 115);
DNFTOOL::WriteInt(4962582, 539 + 115);
DNFTOOL::WriteInt(4962763, 593);
DNFTOOL::WriteInt(4962673, 593);
DNFTOOL::WriteInt(4962577, 593);
DNFTOOL::WriteInt(5008389, 413 + 305); //疲劳值文字标识 X轴
DNFTOOL::WriteInt(5008384, 550 + 41); //疲劳值文字标识 Y轴
DNFTOOL::WriteInt(5008743, 413 + 305); //疯狂阶段文字标识① X轴
DNFTOOL::WriteInt(5008738, 550 + 41); //疯狂阶段文字标识① Y轴
DNFTOOL::WriteInt(5008868, 413 + 305); //疯狂阶段文字标识② X轴
DNFTOOL::WriteInt(5008863, 550 + 41); //疯狂阶段文字标识② Y轴
BYTE N[] = { 153 };
DNFTOOL::WriteByteArr(5008027, N, 1); //疲劳条识别区域宽度
BYTE O[] = { 8 };
DNFTOOL::WriteByteArr(5008045, O, 1); //疲劳条识别区域高度
DNFTOOL::WriteInt(5008021, 4294966650); //疲劳条识别区域 X轴 FFFFFEAF → lea edx,[edi-00000151]
DNFTOOL::WriteInt(5008039, 4294966706); //疲劳条识别区域 Y轴 FFFFFDDD → lea eax,[esi-00000223]
////物品栏坐标
BYTE WPL[] = { 31 };
DNFTOOL::WriteByteArr(5037196, WPL, 1);
DNFTOOL::WriteInt(5037103, 1);
DNFTOOL::WriteInt(5037173, 570);
DNFTOOL::WriteInt(5037202, 271);
////扩展技能栏坐标
BYTE SPL[] = { 31 };
DNFTOOL::WriteByteArr(5037480, WPL, 1);
DNFTOOL::WriteInt(5037374, 298);
DNFTOOL::WriteInt(5037444, 535);
DNFTOOL::WriteInt(5037486, 478);
BYTE buf[] = { 194, 12, 0 };
////干掉nut初始化基础技能栏坐标
DNFTOOL::WriteByteArr(4928048, buf, 3);
////基础技能栏坐标
BYTE SSPL[] = { 31 };
DNFTOOL::WriteByteArr(5037302, WPL, 1);
DNFTOOL::WriteInt(5037209, 298);
DNFTOOL::WriteInt(5037279, 566);
DNFTOOL::WriteInt(5037308, 478);
////支援兵
DNFTOOL::WriteInt(7247082, 1679);
DNFTOOL::WriteInt(7247077, 486);
////活动按钮图标
BYTE J[] = { 114 };
DNFTOOL::WriteByteArr(5105455, J, 1);
DNFTOOL::WriteInt(5105439, 96527);
////buff图标及提示文字坐标
BYTE K[] = { 0 };
DNFTOOL::WriteByteArr(5016598, K, 1);
DNFTOOL::WriteInt(5016565, 546);
DNFTOOL::WriteByteArr(4978018, K, 1);
DNFTOOL::WriteInt(4978010, 546);
////被动技能栏
DNFTOOL::WriteInt(5037996, 284);
DNFTOOL::WriteInt(5037991, 532);
}
2022-02-03 19:20:05 +08:00
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
2022-05-07 14:31:17 +08:00
2022-09-06 00:08:26 +08:00
2023-04-14 14:56:01 +08:00
#ifdef HUDUI_100
HookHudUi();
#endif
#ifdef COUTWINDOWS_SWITCH
2022-11-06 23:12:18 +08:00
2022-05-07 14:31:17 +08:00
AllocConsole();
2023-04-14 14:56:01 +08:00
SetConsoleTitleA("Lenheart");
//SetConsoleOutputCP(65001);
2022-05-07 14:31:17 +08:00
freopen(("CONOUT$"), ("w"), stdout);
freopen(("CONOUT$"), ("w"), stderr);
freopen(("CONIN$"), ("r"), stdin);
2022-11-06 23:12:18 +08:00
2022-05-07 14:31:17 +08:00
#endif
2023-04-14 14:56:01 +08:00
2022-09-06 00:08:26 +08:00
//getchar();
2022-03-08 12:57:35 +08:00
hook::RegisterHook();
2022-02-03 19:20:05 +08:00
Lenheart();
2023-04-14 14:56:01 +08:00
2022-02-10 14:14:08 +08:00
break;
2022-02-03 19:20:05 +08:00
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}