diff --git a/test/DNFTOOL.cpp b/test/DNFTOOL.cpp index 1a72640..81fb742 100644 --- a/test/DNFTOOL.cpp +++ b/test/DNFTOOL.cpp @@ -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 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 BaseDataBuffer; DNFTOOL::Split(Body, BaseDataBuffer, "$$$$$"); size_t Ds = BaseDataBuffer.size(); - for (size_t i = 0; i < Ds; i++) + std::vector 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 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; } diff --git a/test/DNFTOOL.h b/test/DNFTOOL.h index 9fbbe00..fd71a95 100644 --- a/test/DNFTOOL.h +++ b/test/DNFTOOL.h @@ -69,7 +69,7 @@ public: static std::string GetUserIp(); //验证IP是否通过 - static bool ReqIpLicense(std::string ippack, std::string Rqip); + static bool ReqIpLicense(std::string ippack, std::string Rqip = ""); //获取EXE使用头 号位数据 diff --git a/test/RSAC.cpp b/test/RSAC.cpp index d2247ad..28fee9f 100644 --- a/test/RSAC.cpp +++ b/test/RSAC.cpp @@ -10,8 +10,8 @@ char CutcodeChar(char c, int key, int key2) { } //解密 -void Cutecode(char* pstr, int* pkey) { - int len = strlen(pstr); +void Cutecode(char* pstr, int* pkey,int len) { + if(len == -1)len = strlen(pstr); for (int i = 0; i < len; i++) *(pstr + i) = CutcodeChar(*(pstr + i), pkey[i % 5], pkey[(i + 18) % 5]); } \ No newline at end of file diff --git a/test/RSAC.h b/test/RSAC.h index 2ff4980..36a4102 100644 --- a/test/RSAC.h +++ b/test/RSAC.h @@ -2,4 +2,4 @@ void Makecode(char* pstr, int* pkey); -void Cutecode(char* pstr, int* pkey); \ No newline at end of file +void Cutecode(char* pstr, int* pkey,int len = -1); \ No newline at end of file diff --git a/test/dllmain.cpp b/test/dllmain.cpp index 72b4d4b..015eaa4 100644 --- a/test/dllmain.cpp +++ b/test/dllmain.cpp @@ -99,16 +99,18 @@ void LenheartThread() */ //std::cout << "楠岃瘉IP:" << ippack << std::endl; - std::vector IpArr; - DNFTOOL::Split(Rqip, IpArr, "->"); + bool In = DNFTOOL::ReqIpLicense(ippack); - for (auto it = IpArr.begin(); it != IpArr.end(); ++it) { - //楠岃瘉骞惰姹傚姞杞借剼鏈 - std::string Iname = *it; - bool In = DNFTOOL::ReqIpLicense(ippack, Iname); - //std::cout << Iname << "杩炴帴鐘舵:" << In << std::endl; - if (In)return; - } + //std::vector IpArr; + //DNFTOOL::Split(Rqip, IpArr, "->"); + + //for (auto it = IpArr.begin(); it != IpArr.end(); ++it) { + // //楠岃瘉骞惰姹傚姞杞借剼鏈 + // std::string Iname = *it; + // bool In = DNFTOOL::ReqIpLicense(ippack, Iname); + // //std::cout << Iname << "杩炴帴鐘舵:" << In << std::endl; + // if (In)return; + //} return; @@ -331,8 +333,6 @@ BOOL APIENTRY DllMain(HINSTANCE hModule, freopen(("CONIN$"), ("r"), stdin); } - - //鏄惁寮鍚帶鍒跺彴 #ifdef COUTWINDOWS_SWITCH AllocConsole(); diff --git a/test/hook.cpp b/test/hook.cpp index 9d400cb..3429df1 100644 --- a/test/hook.cpp +++ b/test/hook.cpp @@ -107,6 +107,8 @@ uint32_t __cdecl LMySqPushString(uint32_t v, const wchar_t* s, uint32_t l) return LrealSqPushString(v, L"L_getCurrentModuleDamageRate", l); } + wprintf(L"调用函数: %s", s); + return LrealSqPushString(v, s, l); } @@ -1844,7 +1846,7 @@ void Suxn() { std::string str = BaseData[i]; - //std::cout << nutstr << std::endl; + //std::cout << str << std::endl << std::flush; wchar_t* sfile = DNFTOOL::charTowchar_t((char*)filename.c_str()); wchar_t* ss = DNFTOOL::charTowchar_t((char*)str.c_str()); diff --git a/test/include/squirrel.h b/test/include/squirrel.h index f5d64d3..d6a775c 100644 --- a/test/include/squirrel.h +++ b/test/include/squirrel.h @@ -266,7 +266,9 @@ SQUIRREL_API SQInteger sq_getvmstate(HSQUIRRELVM v); /*compiler*/ SQUIRREL_API SQRESULT sq_compile(HSQUIRRELVM v,SQLEXREADFUNC read,SQUserPointer p,const SQChar *sourcename,SQBool raiseerror); +SQUIRREL_API SQRESULT sq_mycompile(HSQUIRRELVM v, SQLEXREADFUNC read, SQUserPointer p, const SQChar* sourcename, SQBool raiseerror); SQUIRREL_API SQRESULT sq_compilebuffer(HSQUIRRELVM v,const SQChar *s,SQInteger size,const SQChar *sourcename,SQBool raiseerror); +SQUIRREL_API SQRESULT sq_mycompilebuffer(HSQUIRRELVM v, const SQChar* s, SQInteger size, const SQChar* sourcename, SQBool raiseerror); SQUIRREL_API void sq_enabledebuginfo(HSQUIRRELVM v, SQBool enable); SQUIRREL_API void sq_notifyallexceptions(HSQUIRRELVM v, SQBool enable); SQUIRREL_API void sq_setcompilererrorhandler(HSQUIRRELVM v,SQCOMPILERERROR f); diff --git a/test/lib/squirrel.lib b/test/lib/squirrel.lib index ad1b5b5..d2b4321 100644 Binary files a/test/lib/squirrel.lib and b/test/lib/squirrel.lib differ diff --git a/test/lsquirrel.h b/test/lsquirrel.h index 488f7db..8df7cae 100644 --- a/test/lsquirrel.h +++ b/test/lsquirrel.h @@ -197,6 +197,7 @@ static SQ_CompileFunc* SQ_Compile = (SQ_CompileFunc*)0x135A390; //SQ_Compilebuffer typedef int(SQ_CompilebufferFunc)(uint32_t v, const wchar_t* s,int size, wchar_t* filename, BOOL printerror); static SQ_CompilebufferFunc* SQ_Compilebuffer = (SQ_CompilebufferFunc*)0x135B2C0; + //SQ_Throwerror typedef int(SQ_ThrowerrorFunc)(uint32_t v, const wchar_t* error); static SQ_ThrowerrorFunc* SQ_Throwerror = (SQ_ThrowerrorFunc*)0x13591A0; diff --git a/test/pch.h b/test/pch.h index 8c1d90f..70e5d72 100644 --- a/test/pch.h +++ b/test/pch.h @@ -1,6 +1,7 @@ 锘#pragma once #define _CRT_SECURE_NO_WARNINGS #define WIN32_LEAN_AND_MEAN // 浠 Windows 澶存枃浠朵腑鎺掗櫎鏋佸皯浣跨敤鐨勫唴瀹 + // Windows 澶存枃浠 #include #include @@ -26,22 +27,20 @@ #include "Helpers.h" -//#define CPPHTTPLIB_OPENSSL_SUPPORT //#include "framework.h" #include "RSAC.h" #include "BASE64.h" -#include "httplib.h" //#define LOCALHOSTS_SWITCH "鏈湴鍏嶉獙璇 寮鍚" - +#define INVERSION "24042201" //#define SELL "璇锋眰鑴氭湰 寮鍚" +//#define SELLDEBUG "璇锋眰鑴氭湰 璋冭瘯" //#define RsHook "RsHook 寮鍚" //#define DOFILE_HOOK "缇ゆ湇dofile hook" - //#define COUTWINDOWS_SWITCH "杈撳嚭绐楀彛 寮鍚" #ifndef SELL diff --git a/test/squirrel.cpp b/test/squirrel.cpp index 1c1f65e..faf6fb5 100644 --- a/test/squirrel.cpp +++ b/test/squirrel.cpp @@ -1,7 +1,51 @@ #include "pch.h" #include "lsquirrel.h" +#include "sqstdsystem.h" +#include +#include + +struct BufState { + const wchar_t* buf; + int ptr; + int size; +}; +int sq_mycompilebuffer(uint32_t v, const wchar_t* s, int size, const wchar_t* filename, BOOL printerror) { + BufState buf; + buf.buf = s; + buf.size = size; + buf.ptr = 0; + return SQ_Compile(v, (LSQLEXREADFUNC)0x1359AD0, &buf, filename, printerror); +} + +int squirrel::SQdofileBuffer(uint32_t v, const wchar_t* filename, const wchar_t* str) +{ + //sq_compilebuffer((HSQUIRRELVM)v, str, wcslen(str), L"interactive console", false); + ////int oldtop = SQGetTop(v); + //if (SQ_Compilebuffer(v, str, wcslen(str), L"interactive console", false) >= 0) + //{ + // SQPushRootTable(v); + // SQ_Call(v, 1, 1, 1); + // SQPop(v, 1); + //} + ////SQPop(v, oldtop); + +#ifdef SELLDEBUG + if (sq_mycompilebuffer(v, str, wcslen(str), filename, true) >= 0) { + SQPushRootTable(v); + SQ_Call(v, 1, 1, 1); + SQPop(v, 1); + } +#else + if (sq_mycompilebuffer(v, str, wcslen(str), L"interactive console", false) >= 0) { + SQPushRootTable(v); + SQ_Call(v, 1, 1, 0); + SQPop(v, 1); +} +#endif // SELLDEBUG + return -1; +} int squirrel::SQloadfile(uint32_t v, const wchar_t* filename, BOOL printerror) @@ -50,18 +94,7 @@ int squirrel::SQdofile(uint32_t v, const wchar_t* filename, BOOL retval, BOOL pr } -int squirrel::SQdofileBuffer(uint32_t v, const wchar_t* filename, const wchar_t* str) -{ - //int oldtop = SQGetTop(v); - if (SQ_Compilebuffer(v, str, wcslen(str), L"interactive console", false) >= 0) - { - SQPushRootTable(v); - SQ_Call(v, 1, 1, 1); - SQPop(v, 1); - } - //SQPop(v, oldtop); - return -1; -} + int squirrel::LenheartGetIntData(uint32_t v) { @@ -2513,9 +2546,43 @@ int squirrel::sq_Cmd(uint32_t v) char* OutPutText = DNFTOOL::SquirrelU2W(OutPutBuffer); system(OutPutText); - //WinExec(OutPutText, SW_NORMAL); + //WinExec(OutPutText, SW_HIDE); delete[]OutPutText; - return 1; + return 0; +} +int sq_CmdEx(uint32_t v) +{ + wchar_t* OutPutBuffer; + SQGetString(v, 2, &OutPutBuffer); + char* OutPutText = DNFTOOL::SquirrelU2W(OutPutBuffer); + + STARTUPINFOA si = { sizeof(STARTUPINFO) }; + PROCESS_INFORMATION pi; + + // 创建新进程 + BOOL result = CreateProcessA( + NULL, // 应用程序名称 + OutPutText, // 命令行参数 + NULL, // 进程安全属性 + NULL, // 线程安全属性 + FALSE, // 继承句柄选项 + 0, // 创建标志 + NULL, // 环境变量 + NULL, // 当前目录 + &si, // STARTUPINFO + &pi // PROCESS_INFORMATION + ); + + if (result) { + // 不等待新进程结束,直接关闭句柄 + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + } + else { + } + + delete[]OutPutText; + return 0; } //设置UI槽坐标 int squirrel::SetSlot(uint32_t v) @@ -3671,6 +3738,7 @@ void squirrel::R_Register_Nut() #if defined NEW_WINDOW_API_SWITCH RegisterNutApi(L"L_NewWindows", squirrel::NewWindows);//创建窗口 RegisterNutApi(L"L_Cmd", squirrel::sq_Cmd);//创建窗口 + RegisterNutApi(L"L_CmdEx", sq_CmdEx);//创建窗口 #endif #if defined SET_SLOT_API_SWITCH @@ -3837,6 +3905,10 @@ void printfunc(HSQUIRRELVM v, const SQChar* s, ...) void squirrel::InitGameScript() { uint32_t v = GetSqVm(); + + + + //消息框黏贴 #ifdef COPY_MESSAGE * (WORD*)0x011C53B0 = 0x01B0; diff --git a/test/test.vcxproj b/test/test.vcxproj index 6f3e0fc..23e2ec7 100644 --- a/test/test.vcxproj +++ b/test/test.vcxproj @@ -23,7 +23,7 @@ Win32Proj {f3d55a8b-a1e8-4e81-a655-5f2bf73b00e9} test - 7.0 + 10.0 DOF_DllHook @@ -36,9 +36,9 @@ DynamicLibrary false - v141_xp true Unicode + v141_xp DynamicLibrary @@ -79,8 +79,8 @@ false I:\DOF\鏂板鎴风\Plugins\ - G:\Qt\Tools\OpenSSL\Win_x86\lib;$(LibraryPath) - C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;Z:\Visual Studio\VS_C_AND_C++_PROJECT\DOF_DllHook\test\Detours\include;Z:\Visual Studio\VS_C_AND_C++_PROJECT\DOF_DllHook\test\imgui;G:\Qt\Tools\OpenSSL\Win_x86\include;$(IncludePath) + $(LibraryPath) + F:\zhuomian\1.1.1a\x86\nt\include;F:\nut\SQUIRREL2\include;F:\nut\SQUIRREL2\squirrel;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;Z:\Visual Studio\VS_C_AND_C++_PROJECT\DOF_DllHook\test\Detours\include;Z:\Visual Studio\VS_C_AND_C++_PROJECT\DOF_DllHook\test\imgui;$(IncludePath) Lenheart @@ -126,6 +126,7 @@ Full 4244;4018;4996; true + F:\nut\SQUIRREL2\sq;F:\nut\SQUIRREL2\squirrel;F:\nut\SQUIRREL2\sqstdlib;F:\nut\SQUIRREL2;%(AdditionalIncludeDirectories) Console @@ -134,7 +135,7 @@ true false libMinHook.x86.lib;libcrypto.lib;libssl.lib;squirrel.lib;sqstdlib.lib;Imm32.lib;%(AdditionalDependencies) - H:\Visual Studio\VS_C_AND_C++_PROJECT\DOF_DllHook\test\lib;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;Z:\Visual Studio\VS_C_AND_C++_PROJECT\DOF_DllHook\test\Detours\lib.X86;D:\hookDNF\DOF_DllHook\test;E:\openssl\lib;%(AdditionalLibraryDirectories) + F:\zhuomian\1.1.1a\x86\nt\lib;H:\Visual Studio\VS_C_AND_C++_PROJECT\DOF_DllHook\test\lib;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;Z:\Visual Studio\VS_C_AND_C++_PROJECT\DOF_DllHook\test\Detours\lib.X86;D:\hookDNF\DOF_DllHook\test;%(AdditionalLibraryDirectories)