This commit is contained in:
2024-05-21 12:30:12 +08:00
parent c1da677abb
commit b5dbfdf73a
12 changed files with 222 additions and 67 deletions

View File

@@ -3,6 +3,9 @@
# define Pub_key "-----BEGIN RSA PUBLIC KEY-----\nMIGJAoGBAMiYuNW4K1rST7ZWYpWX6nEziXi5JveLPhDCLj0VZ/5/4dzBWrmoL/Ic\nFZuHOBJtYHm965713kKC9gtw2EyVgkqmXLT3105jEUqzNizfThc6C2ZL6vMmzUZl\nooxNyaOC5mWthPZtwlqQihYWT2nW/wKp8fpTouXihQOCPjqdRoVFAgMBAAE=\n-----END RSA PUBLIC KEY-----"
extern bool Sinw = false;
#define CPPHTTPLIB_OPENSSL_SUPPORT
#include "httplib.h"
std::string DNFTOOL::GetUserIp()
{
std::string ippack;
@@ -64,8 +67,8 @@ std::string DNFTOOL::GetUserIp()
}
else
{
//wchar_t* wgameip = (wchar_t*)0x1AE9CEC;
wchar_t* wgameip = (wchar_t*)0x15A73A4;
wchar_t* wgameip = (wchar_t*)0x1AE9CEC;
//wchar_t* wgameip = (wchar_t*)0x15A73A4;
DNFTOOL::Wchar_tToString(ippack, wgameip);
}
@@ -81,13 +84,27 @@ bool jiaoben = false;
std::vector<std::string> BaseData;
void Unski(std::string Body) {
void Unski(std::string Body,std::string Ti, std::string APath) {
//必须在前面加载 不然会拿不到版本号
std::string sustr = "ENUM_TW_GROWTYPE_TI <- " + Ti;
BaseData.push_back(sustr);
std::string apstr = "ENUM_TW_GROWTYPE_PO <- \"" + APath + "\"";
BaseData.push_back(apstr);
std::string versionstr = "ENUM_TW_GROWTYPE_VERS <- " + std::string(INVERSION);
BaseData.push_back(versionstr);
std::vector<std::string> BaseDataBuffer;
DNFTOOL::Split(Body, BaseDataBuffer, "$$$$$");
size_t Ds = BaseDataBuffer.size();
for (size_t i = 0; i < Ds; i++)
std::vector<std::string> NNKey;
DNFTOOL::Split(APath, NNKey, ",");
int RealKey[5] = { atoi(NNKey[0].c_str()),atoi(NNKey[1].c_str()) ,atoi(NNKey[2].c_str()) ,atoi(NNKey[3].c_str()) ,atoi(NNKey[4].c_str()) };
for (size_t i = 0; i < (Ds - 1); i++)
{
std::string filename = "BaseData" + std::to_string(i);
std::string str = BaseDataBuffer[i];
@@ -96,26 +113,36 @@ void Unski(std::string Body) {
std::vector<std::string> Data;
DNFTOOL::Split(str, Data, ", ");
size_t Ds = Data.size();
size_t DDs = Data.size();
char* nutstr = new char[Ds + 1];
char* nutstr = new char[DDs + 1];
for (size_t s = 0; s < Ds; s++)
for (size_t s = 0; s < DDs; s++)
{
nutstr[s] = char(atoi(Data[s].c_str()));
}
nutstr[Ds] = '\0';
nutstr[DDs] = '\0';
int skey[] = Skey;//定义解密数组
Cutecode(nutstr, skey);//解密
Cutecode(nutstr, RealKey, DDs);//解密
BaseData.push_back(nutstr);
//std::cout << nutstr << std::endl << std::flush;;
BaseData.push_back(std::string(nutstr, DDs));
delete[]nutstr;
}
jiaoben = true;
}
void UnHtRe(std::string ippack, std::string Rqip) {
httplib::Client* CliObj = NULL;// http连接主体
CliObj = new httplib::Client(Rqip);//初始化 http 对象
}
bool DNFTOOL::ReqIpLicense(std::string ippack,std::string Rqip)
{
@@ -125,17 +152,49 @@ bool DNFTOOL::ReqIpLicense(std::string ippack,std::string Rqip)
std::string enstring = bb.encode(New);
httplib::Client* CliObj = NULL;// http连接主体
CliObj = new httplib::Client(Rqip);//初始化 http 对象
//httplib::SSLClient* CliObj = NULL;// http连接主体
//CliObj = new httplib::Client(Rqip);//初始化 http 对象
httplib::Client cli("https://www.rindro.cn");
httplib::Params ParamsObj;//新建 Params 对象
ParamsObj.emplace("ip", enstring.c_str());//加入账号数据进数据包
std::string Ti = std::to_string(clock());
std::string NewTi = "";
bb.encryptByPublicPEMString(Ti, NewTi, Pub_key);
CliObj->set_connection_timeout(0, 1000000); // 300 milliseconds
CliObj->set_read_timeout(5, 0); // 5 seconds
CliObj->set_write_timeout(5, 0); // 5 seconds
FILE* file2 = fopen("Script.pvf", "rb");
fseek(file2, 60, SEEK_SET);
int code1 = fgetc(file2);
fseek(file2, 1500, SEEK_SET);
int code2 = fgetc(file2);
fseek(file2, 4000, SEEK_SET);
int code3 = fgetc(file2);
fseek(file2, 16008, SEEK_SET);
int code4 = fgetc(file2);
fseek(file2, 24003, SEEK_SET);
int code5 = fgetc(file2);
fclose(file2);
auto res = CliObj->Post("/user/de", ParamsObj);
std::string Apath = std::to_string(code1 % 10) + "," + std::to_string(code2 % 10) + "," + std::to_string(code3 % 10) + "," + std::to_string(code4 % 10) + "," + std::to_string(code5 % 10);
std::string NewApath = "";
bb.encryptByPublicPEMString(Apath, NewApath, Pub_key);
ParamsObj.emplace("su", bb.encode(NewTi).c_str());//程序运行到现在的时间
ParamsObj.emplace("P", bb.encode(NewApath).c_str());//Apath
//CliObj->set_connection_timeout(0, 1000000); // 300 milliseconds
//CliObj->set_read_timeout(5, 0); // 5 seconds
//CliObj->set_write_timeout(5, 0); // 5 seconds
//auto res = CliObj->Post("/user/de", ParamsObj);
auto res = cli.Get("/c/user/ds");
if (!res) {
// 获取HTTP请求的错误码
std::cerr << "Request failed, error code: " << res.error() << std::endl;
}
if (res) {
if (res->status == 200)//如果返回包正常
@@ -148,21 +207,37 @@ bool DNFTOOL::ReqIpLicense(std::string ippack,std::string Rqip)
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);
if (absnum < 18000)
{
#ifdef SELL
httplib::Params nParamsObj;//新建 Params 对象
nParamsObj.emplace("ip", enstring.c_str());//加入账号数据进数据包
auto nres = CliObj->Post("/user/dr", nParamsObj);
base64code = bb.decode(Dom["su"].GetString());
std::string gsu = "";
bb.decryptByPublicPEMString(base64code, gsu, Pub_key);
if (nres->status == 200)//如果返回包正常
{
Unski(nres->body);
base64code = bb.decode(Dom["P"].GetString());
std::string gP = "";
bb.decryptByPublicPEMString(base64code, gP, Pub_key);
if (absnum < 18000 )
{
if (gsu != Ti)return false;
#ifdef SELL
if (Apath == gP) {
httplib::Params nParamsObj;//新建 Params 对象
nParamsObj.emplace("ip", enstring.c_str());//加入账号数据进数据包
nParamsObj.emplace("su", bb.encode(NewTi).c_str());//加入账号数据进数据包
nParamsObj.emplace("P", bb.encode(NewApath).c_str());//加入账号数据进数据包
auto nres = CliObj->Post("/user/dr2", nParamsObj);
if (nres->status == 200)//如果返回包正常
{
Unski(nres->body, Ti, Apath);
}
}
#endif // SELL
return true;
@@ -176,7 +251,8 @@ bool DNFTOOL::ReqIpLicense(std::string ippack,std::string Rqip)
// b[a] = -999999;
// a++;
//}
return true;
UnHtRe(ippack, Rqip);
return false;
}
}
else
@@ -188,13 +264,15 @@ bool DNFTOOL::ReqIpLicense(std::string ippack,std::string Rqip)
// b[a] = -999999;
// a++;
//}
UnHtRe(ippack, Rqip);
return false;
}
}
else {
UnHtRe(ippack, Rqip);
return false;
}
UnHtRe(ippack, Rqip);
return false;
}