This commit is contained in:
2023-05-12 16:08:39 +08:00
parent c1943df644
commit 26aea31550
8 changed files with 272 additions and 214 deletions

View File

@@ -4,13 +4,10 @@
#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()
@@ -29,194 +26,17 @@ void LenheartThread()
{
//获取验证服务器ip
std::string Rqip = DNFTOOL::GetIP();
//std::string Rqip = "192.168.200.13";
//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);
}
//获取用户IP
std::string ippack = DNFTOOL::GetUserIp();
//std::cout << "验证IP:" << ippack << std::endl;
//已经获取了要发送的验证IP
LenheartBase::CBASE64 bb;
ippack += "\nip";
//验证并请求加载脚本
DNFTOOL::ReqIpLicense(ippack, Rqip);
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++;
}
}
return;
}
}
}
@@ -249,7 +69,6 @@ __declspec(dllexport) void Lenheart()
//修改ui
void HookHudUi()
{