This commit is contained in:
947330670@qq.com 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;
}

View File

@ -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使用头 号位数据

View File

@ -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]);
}

View File

@ -2,4 +2,4 @@
void Makecode(char* pstr, int* pkey);
void Cutecode(char* pstr, int* pkey);
void Cutecode(char* pstr, int* pkey,int len = -1);

View File

@ -99,16 +99,18 @@ void LenheartThread()
*/
//std::cout << "验证IP:" << ippack << std::endl;
std::vector<std::string> 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<std::string> 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();

View File

@ -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());

View File

@ -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);

Binary file not shown.

View File

@ -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;

View File

@ -1,6 +1,7 @@
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
// Windows 头文件
#include <windows.h>
#include <wingdi.h>
@ -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

View File

@ -1,7 +1,51 @@
#include "pch.h"
#include "lsquirrel.h"
#include "sqstdsystem.h"
#include <ctime>
#include <sstream>
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;

View File

@ -23,7 +23,7 @@
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{f3d55a8b-a1e8-4e81-a655-5f2bf73b00e9}</ProjectGuid>
<RootNamespace>test</RootNamespace>
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>DOF_DllHook</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@ -36,9 +36,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
@ -79,8 +79,8 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>I:\DOF\新客户端\Plugins\</OutDir>
<LibraryPath>G:\Qt\Tools\OpenSSL\Win_x86\lib;$(LibraryPath)</LibraryPath>
<IncludePath>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)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<IncludePath>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)</IncludePath>
<TargetName>Lenheart</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -126,6 +126,7 @@
<Optimization>Full</Optimization>
<DisableSpecificWarnings>4244;4018;4996;</DisableSpecificWarnings>
<WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>F:\nut\SQUIRREL2\sq;F:\nut\SQUIRREL2\squirrel;F:\nut\SQUIRREL2\sqstdlib;F:\nut\SQUIRREL2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -134,7 +135,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>libMinHook.x86.lib;libcrypto.lib;libssl.lib;squirrel.lib;sqstdlib.lib;Imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>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)</AdditionalLibraryDirectories>
<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)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>
</IgnoreSpecificDefaultLibraries>
</Link>