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

@@ -1,5 +1,175 @@
#include "pch.h"
#include "DNFTOOL.h"
# define Pub_key "-----BEGIN RSA PUBLIC KEY-----\nMIGJAoGBAMiYuNW4K1rST7ZWYpWX6nEziXi5JveLPhDCLj0VZ/5/4dzBWrmoL/Ic\nFZuHOBJtYHm965713kKC9gtw2EyVgkqmXLT3105jEUqzNizfThc6C2ZL6vMmzUZl\nooxNyaOC5mWthPZtwlqQihYWT2nW/wKp8fpTouXihQOCPjqdRoVFAgMBAAE=\n-----END RSA PUBLIC KEY-----"
extern bool Sinw = false;
std::string DNFTOOL::GetUserIp()
{
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);
}
return ippack;
}
bool DNFTOOL::ReqIpLicense(std::string ippack,std::string Rqip)
{
LenheartBase::CBASE64 bb;
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("ip", enstring.c_str());//加入账号数据进数据包
auto res = CliObj->Post("/user/current", ParamsObj);
if (res->status == 200)//如果返回包正常
{
std::string date = res->body;//取得date
rapidjson::Document Dom;
Dom.Parse(date.c_str());//加载 字符串
std::string base64code = bb.decode(Dom["verify"].GetString());
std::string verify = "";
bb.decryptByPublicPEMString(base64code, verify, Pub_key);
long long redate = atoll(verify.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
int Size = Dom["size"].GetInt();//判断类型
std::cout << Size << std::endl;
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);
std::cout << i << std::endl;
uint32_t v = GetSqVm();
squirrel::SQdofileBuffer(v, sfile, ss);
}
#endif // SELL
return true;
}
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++;
}
}
}
int DNFTOOL::GetExeNutWrtNum(int Pos)
{