This commit is contained in:
2023-11-13 14:00:01 +08:00
parent 26aea31550
commit a1b9f7a32d
22 changed files with 28662 additions and 412 deletions

View File

@@ -71,6 +71,9 @@ std::string DNFTOOL::GetUserIp()
return ippack;
}
//std::string basejiaoben;
bool jiaoben = false;
std::vector<std::string> BaseData;
bool DNFTOOL::ReqIpLicense(std::string ippack,std::string Rqip)
{
LenheartBase::CBASE64 bb;
@@ -80,95 +83,77 @@ bool DNFTOOL::ReqIpLicense(std::string ippack,std::string Rqip)
httplib::Client* CliObj = NULL;// http连接主体
CliObj = new httplib::Client(Rqip + ":9007");//初始化 http 对象
CliObj = new httplib::Client(Rqip);//初始化 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
CliObj->set_connection_timeout(0, 1000000); // 300 milliseconds
CliObj->set_read_timeout(5, 0); // 5 seconds
CliObj->set_write_timeout(5, 0); // 5 seconds
rapidjson::Document Dom;
Dom.Parse(date.c_str());//加载 字符串
auto res = CliObj->Post("/user/de", ParamsObj);
std::string base64code = bb.decode(Dom["verify"].GetString());
std::string verify = "";
bb.decryptByPublicPEMString(base64code, verify, Pub_key);
if (res) {
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)
if (res->status == 200)//如果返回包正常
{
Sinw = true;
#ifdef SELL
std::string date = res->body;//取得date
int Size = Dom["size"].GetInt();//判断类型
std::cout << Size << std::endl;
for (int i = 0; i < Size; i++)
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);
if (absnum < 18000)
{
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;
#ifdef SELL
httplib::Params nParamsObj;//新建 Params 对象
nParamsObj.emplace("ip", enstring.c_str());//加入账号数据进数据包
auto nres = CliObj->Post("/user/dr", nParamsObj);
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++)
if (nres->status == 200)//如果返回包正常
{
nutstr[s] = char(atoi(Data[s].c_str()));
DNFTOOL::Split(nres->body, BaseData, "$$$$$");
jiaoben = true;
}
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;
return true;
}
else
{
//int a = 10;
//int b[2] = { 1,2 };
//while (true)
//{
// b[a] = -999999;
// a++;
//}
return true;
}
}
else
{
int a = 10;
int b[2] = { 1,2 };
while (true)
{
b[a] = -999999;
a++;
}
//int a = 10;
//int b[2] = { 1,2 };
//while (true)
//{
// b[a] = -999999;
// a++;
//}
return false;
}
}
else
{
int a = 10;
int b[2] = { 1,2 };
while (true)
{
b[a] = -999999;
a++;
}
else {
return false;
}
return false;
}
int DNFTOOL::GetExeNutWrtNum(int Pos)
@@ -577,6 +562,20 @@ void DNFTOOL::GMNotice(char* str, int type, int color)
_Noticecall(thisc, 0, str, color, type, 0, 0, 0);
}
std::string DNFTOOL::ReplaceAllword(const std::string& resources, const std::string& key, const std::string& ReplaceKey)
{
size_t pos = 0;
std::string temp = resources;
while ((pos = temp.find(key, pos)) != std::string::npos)
{
temp.erase(pos, key.size());//删除原有字符串
temp.insert(pos, ReplaceKey);//插入替换字符串
pos += ReplaceKey.size(); //更新查询起始标志位
}
return temp;
}
#if defined LOCALHOSTS_SWITCH
#else
@@ -621,7 +620,7 @@ std::string DNFTOOL::GetIP()
}
char* uncode = (char*)Ip.c_str();
int skey[] = Skey;//定义解密数组
int skey[] = DFCSkey;//定义解密数组
Cutecode(uncode, skey);//解密