DNF_DLL/test/dllmain.cpp

402 lines
12 KiB
C++

// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
# define Pub_key "-----BEGIN RSA PUBLIC KEY-----\nMIGJAoGBAMiYuNW4K1rST7ZWYpWX6nEziXi5JveLPhDCLj0VZ/5/4dzBWrmoL/Ic\nFZuHOBJtYHm965713kKC9gtw2EyVgkqmXLT3105jEUqzNizfThc6C2ZL6vMmzUZl\nooxNyaOC5mWthPZtwlqQihYWT2nW/wKp8fpTouXihQOCPjqdRoVFAgMBAAE=\n-----END RSA PUBLIC KEY-----"
int LbState = 0;
int RbState = 0;
int MbState = 0;
extern bool Sinw = false;
void LenheartThread()
{
while (true)
{
Sleep(10);
static int ;
if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 6)
{
//imguiC* ImguiObj = new imguiC();
//ImguiObj->Run();
= 1;
}
if ( == 1)
{
//获取验证服务器ip
std::string Rqip = DNFTOOL::GetIP();
//std::cout << "验证服务器IP:" << Rqip << std::endl;
//获取验证IP
std::string ippack;
//获取ExeIP
int gameip = *(int*)0x1AE9CEC;
/*
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++;
}
}
*/
//如果ExeIP 等于 192.168.200.131
if (gameip == 3735601)
{
//获取本机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);
ippack = MyIp;
}
else
{
wchar_t* wgameip = (wchar_t*)0x1AE9CEC;
DNFTOOL::Wchar_tToString(ippack, wgameip);
}
//std::cout << "验证IP:" << ippack << std::endl;
//已经获取了要发送的验证IP
LenheartBase::CBASE64 bb;
ippack += "\nip";
std::string New = "";
bb.encryptByPublicPEMString(ippack, New,Pub_key);
std::string enstring = bb.encode(New);
httplib::Client* CliObj = NULL;// http连接主体
CliObj = new httplib::Client(Rqip + ":9007");//初始化 http 对象
httplib::Params ParamsObj;//新建 Params 对象
ParamsObj.emplace("ys", enstring.c_str());//加入账号数据进数据包
auto res = CliObj->Post("/yosin", ParamsObj);
if (res->status == 200)//如果返回包正常
{
std::string date = res->body;//取得date
std::string base64code = bb.decode(date);
std::string decrypt_text = "";
bb.decryptByPublicPEMString(base64code, decrypt_text,Pub_key);
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);
//std::cout << absnum << std::endl;
if (absnum < 18000)
{
Sinw = true;
#ifdef SELL
auto res = CliObj->Post("/transfer/getscript2", ParamsObj);
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);
//wprintf(L"Function:%s \n", ss);
uint32_t v = GetSqVm();
squirrel::SQdofileBuffer(v, sfile, ss);
}
}
}
#endif // SELL
return;
}
else
{
int a = 10;
int b[2] = { 1,2 };
while (true)
{
b[a] = -999999;
a++;
}
}
}
else
{
int a = 10;
int b[2] = { 1,2 };
while (true)
{
b[a] = -999999;
a++;
}
}
}
}
}
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;
}
}
__declspec(dllexport) void Lenheart()
{
DWORD threadID;
HANDLE Thand = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)LenheartThread, NULL, 0, &threadID);
#ifdef MOUSE_SWITCH
DWORD threadID2;
HANDLE Thand2 = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)MouseEvent, NULL, 0, &threadID2);
#endif
}
//修改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);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
#ifdef HUDUI_100
HookHudUi();
#endif
#ifdef COUTWINDOWS_SWITCH
AllocConsole();
SetConsoleTitleA("Lenheart");
//SetConsoleOutputCP(65001);
freopen(("CONOUT$"), ("w"), stdout);
freopen(("CONOUT$"), ("w"), stderr);
freopen(("CONIN$"), ("r"), stdin);
#endif
//getchar();
hook::RegisterHook();
Lenheart();
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}