2022-03-08 12:57:35 +08:00
|
|
|
|
#include "pch.h"
|
|
|
|
|
|
#include "DNFTOOL.h"
|
|
|
|
|
|
|
|
|
|
|
|
int DNFTOOL::GetExeNutWrtNum(int Pos)
|
|
|
|
|
|
{
|
|
|
|
|
|
int num = *(int*)(0x40079F + (Pos * 4));
|
|
|
|
|
|
return num;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DNFTOOL::SetExeNutWrtNum(int Pos, int num)
|
|
|
|
|
|
{
|
|
|
|
|
|
int* p = (int*)(0x40079F + (Pos * 4));
|
|
|
|
|
|
*p = num;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int DNFTOOL::GetNutArrNum(int Nutͷ<EFBFBD><EFBFBD>ַ, int Pos)
|
|
|
|
|
|
{
|
|
|
|
|
|
int num = *(int*)(Nutͷ<EFBFBD><EFBFBD>ַ + (Pos * 8));
|
|
|
|
|
|
return num;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DNFTOOL::SetNutArrNum(int Nutͷ<EFBFBD><EFBFBD>ַ, int Pos, int num)
|
|
|
|
|
|
{
|
|
|
|
|
|
int* p = (int*)(Nutͷ<EFBFBD><EFBFBD>ַ + (Pos * 8));
|
|
|
|
|
|
*p = num;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-27 17:17:12 +08:00
|
|
|
|
int DNFTOOL::GetHook(int Addr, std::string <EFBFBD><EFBFBD>ַ,int Type)
|
2022-03-08 12:57:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
size_t pos = <EFBFBD><EFBFBD>ַ.find("+");
|
|
|
|
|
|
size_t size = <EFBFBD><EFBFBD>ַ.size();
|
|
|
|
|
|
int GetHookArr[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
|
|
while (pos != std::string::npos)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::string x = <EFBFBD><EFBFBD>ַ.substr(0, pos);
|
|
|
|
|
|
GetHookArr[i] = stoi(x, 0, 16);
|
|
|
|
|
|
i++;
|
|
|
|
|
|
<EFBFBD><EFBFBD>ַ = <EFBFBD><EFBFBD>ַ.substr(pos + 1, size);
|
|
|
|
|
|
pos = <EFBFBD><EFBFBD>ַ.find("+");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int num;
|
|
|
|
|
|
num = *(int*)(Addr);
|
|
|
|
|
|
|
|
|
|
|
|
if (num != 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int z = 0; z < i; z++)
|
|
|
|
|
|
{
|
2022-03-27 17:17:12 +08:00
|
|
|
|
if (z == i - 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Type == 0)return *(int*)(num + GetHookArr[z]);
|
|
|
|
|
|
else return (num + GetHookArr[z]);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
num = *(int*)(num + GetHookArr[z]);
|
|
|
|
|
|
}
|
2022-03-08 12:57:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return num;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int DNFTOOL::DNFDeCode(int Address)
|
|
|
|
|
|
{
|
|
|
|
|
|
DWORD nEax, nEcx8, nEsi, nEdx, nTmp;
|
|
|
|
|
|
nEax = *(int*)(Address);
|
|
|
|
|
|
if (nEax == -1)
|
|
|
|
|
|
return nEax;
|
|
|
|
|
|
nEcx8 = *(int*)(Address + 8);
|
|
|
|
|
|
if (nEcx8 == -1)
|
|
|
|
|
|
return nEcx8;
|
|
|
|
|
|
nEsi = *(int*)(0x1AF8D78);
|
|
|
|
|
|
nEdx = nEax >> 16;
|
|
|
|
|
|
nTmp = (nEdx << 2) + nEsi + 36;
|
|
|
|
|
|
nEdx = *(int*)(nTmp);
|
|
|
|
|
|
if (nEdx == -1)
|
|
|
|
|
|
return nEdx;
|
|
|
|
|
|
nEax = nEax & 65535;
|
|
|
|
|
|
nTmp = (nEax << 2) + nEdx + 8468;
|
|
|
|
|
|
nEax = *(int*)(nTmp);
|
|
|
|
|
|
if (nEax == -1)
|
|
|
|
|
|
return nEax;
|
|
|
|
|
|
_asm
|
|
|
|
|
|
{
|
|
|
|
|
|
mov eax, nEax
|
|
|
|
|
|
movzx edx, ax
|
|
|
|
|
|
mov nEdx, edx
|
|
|
|
|
|
}
|
|
|
|
|
|
nEsi = nEdx << 16;
|
|
|
|
|
|
nEsi = nEsi | nEdx;
|
|
|
|
|
|
nEax = nEsi ^ nEcx8;
|
|
|
|
|
|
return nEax;
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DNFTOOL::DNFEnCode(int AddreSs, int Data)
|
|
|
|
|
|
{
|
|
|
|
|
|
long JEdi, JEcx, JEax, JEsi, JEdx, JSs;
|
|
|
|
|
|
JEcx = AddreSs;
|
|
|
|
|
|
JEax = *(int*)(0x1AF8DB8);
|
|
|
|
|
|
JEax = JEax + 1;
|
|
|
|
|
|
*(int*)(0x1AF8DB8) = JEax;
|
|
|
|
|
|
JEdx = JEax;
|
|
|
|
|
|
JEdx = JEdx >> 8;
|
|
|
|
|
|
JEdx = JEdx << 24;
|
|
|
|
|
|
JEdx = JEdx >> 24;
|
|
|
|
|
|
JEdx = *(int*)(JEdx * 2 + 0x1843F58);
|
|
|
|
|
|
JEdx = JEdx & 0xFFFF;
|
|
|
|
|
|
JEax = JEax << 24;
|
|
|
|
|
|
JEax = JEax >> 24;
|
|
|
|
|
|
JSs = *(int*)(JEax * 2 + 0x1844158);
|
|
|
|
|
|
JSs = JSs & 0xFFFF;
|
|
|
|
|
|
JEdx = JEdx ^ JSs;
|
|
|
|
|
|
JEax = JEdx;
|
|
|
|
|
|
JEax = JEax & 0xFFFF;
|
|
|
|
|
|
JEsi = Data;
|
|
|
|
|
|
JEdx = JEsi >> 16;
|
|
|
|
|
|
Sleep(10);
|
|
|
|
|
|
JSs = JEsi & 0xFFFF;
|
|
|
|
|
|
JEdx = JEdx + JSs;
|
|
|
|
|
|
JEdx = JEdx ^ JEax;
|
|
|
|
|
|
JEdi = JEdx;
|
|
|
|
|
|
JEdx = JEax;
|
|
|
|
|
|
JEax = JEax << 16;
|
|
|
|
|
|
JEax = JEax + JEdx;
|
|
|
|
|
|
JEsi = Data;
|
|
|
|
|
|
JEax = JEax ^ JEsi;
|
|
|
|
|
|
JEsi = AddreSs + 8;
|
|
|
|
|
|
*(int*)(JEsi) = JEax;
|
|
|
|
|
|
JEax = *(int*)(AddreSs);
|
|
|
|
|
|
JEsi = *(int*)(0x1AF8D78);
|
|
|
|
|
|
|
|
|
|
|
|
JEcx = JEdi;
|
|
|
|
|
|
JEcx = JEcx << 16;
|
|
|
|
|
|
JEcx = JEcx + JEdx;
|
|
|
|
|
|
JEdx = JEax;
|
|
|
|
|
|
JEdx = JEdx >> 16;
|
|
|
|
|
|
JEdx = *(int*)(JEsi + JEdx * 4 + 36);
|
|
|
|
|
|
JEax = JEax & 0xFFFF;
|
|
|
|
|
|
*(int*)(JEdx + JEax * 4 + 8468) = JEcx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int DNFTOOL::GetEquAddr(int addr)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (addr)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
return 0x3038;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
return 0x304C;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
return 0x3048;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
return 0x3050;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
return 0x3044;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 6:
|
|
|
|
|
|
return 0x3040;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 7:
|
|
|
|
|
|
return 0x3058;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 8:
|
|
|
|
|
|
return 0x305C;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 9:
|
|
|
|
|
|
return 0x3054;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 10:
|
|
|
|
|
|
return 0x3060;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 11:
|
|
|
|
|
|
return 0x3064;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 12:
|
|
|
|
|
|
return 0x3038;
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 13:
|
|
|
|
|
|
return 0x3008;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 14:
|
|
|
|
|
|
return 0x300C;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 15:
|
|
|
|
|
|
return 0x3010;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 16:
|
|
|
|
|
|
return 0x3014;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 17:
|
|
|
|
|
|
return 0x3018;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 18:
|
|
|
|
|
|
return 0x301C;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 19:
|
|
|
|
|
|
return 0x3020;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 20:
|
|
|
|
|
|
return 0x3024;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 21:
|
|
|
|
|
|
return 0x3028;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 22:
|
|
|
|
|
|
return 0x302C;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 23:
|
|
|
|
|
|
return 0x3030;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 24:
|
|
|
|
|
|
return 0x3068;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 25:
|
|
|
|
|
|
return 0x306C;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 26:
|
|
|
|
|
|
return 0x3070;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 27:
|
|
|
|
|
|
return 0x3074;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char* DNFTOOL::UnicodeToAnsi(const wchar_t* szStr, char* pResult, int maxLen)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (NULL == pResult)
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
int nLen = WideCharToMultiByte(CP_ACP, 0, szStr, -1, NULL, 0, NULL, NULL);
|
|
|
|
|
|
if (0 == nLen)
|
|
|
|
|
|
{
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (nLen >= maxLen)
|
|
|
|
|
|
nLen = maxLen;
|
|
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, szStr, -1, pResult, nLen, NULL, NULL);
|
|
|
|
|
|
return pResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-22 02:16:45 +08:00
|
|
|
|
char* DNFTOOL::wchar_tTochar(wchar_t* wbuffer)
|
|
|
|
|
|
{
|
|
|
|
|
|
size_t requiredSize = wcstombs(nullptr, wbuffer, 0);
|
|
|
|
|
|
char* key = new char[requiredSize + 1];
|
|
|
|
|
|
wcstombs(key, wbuffer, requiredSize + 1);
|
|
|
|
|
|
return key;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wchar_t* DNFTOOL::charTowchar_t(char* wbuffer)
|
|
|
|
|
|
{
|
|
|
|
|
|
size_t requiredSize = mbstowcs(nullptr, wbuffer, 0);
|
|
|
|
|
|
wchar_t* wcString = new wchar_t[requiredSize + 1];
|
|
|
|
|
|
mbstowcs(wcString, wbuffer, requiredSize + 1);
|
|
|
|
|
|
return wcString;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-08 12:57:35 +08:00
|
|
|
|
wchar_t* DNFTOOL::AnsiToUnicode(const char* szStr, wchar_t* pResult, int maxLen)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (NULL == pResult)
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
int nLen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szStr, -1, NULL, 0);
|
|
|
|
|
|
if (0 == nLen)
|
|
|
|
|
|
{
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (nLen >= maxLen)
|
|
|
|
|
|
nLen = maxLen;
|
|
|
|
|
|
|
|
|
|
|
|
nLen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szStr, -1, pResult, nLen);
|
|
|
|
|
|
if (0 == nLen)
|
|
|
|
|
|
{
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
return pResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DNFTOOL::WindowsNotice(char* str, int type, int b)
|
|
|
|
|
|
{
|
|
|
|
|
|
DWORD thisc = 0x1A5FB20;
|
|
|
|
|
|
thisc = *(DWORD*)thisc;
|
|
|
|
|
|
_NoticeTcall(thisc, 0, type, str, b);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DNFTOOL::GMNotice(char* str, int type, int color)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (type == NULL)type = 14;
|
|
|
|
|
|
if (color == NULL)color = 0x65535;
|
|
|
|
|
|
DWORD thisc = 0x1A5FB20;
|
|
|
|
|
|
thisc = *(DWORD*)thisc;
|
|
|
|
|
|
thisc = *(DWORD*)(thisc + 0x40);
|
|
|
|
|
|
_Noticecall(thisc, 0, str, color, type, 0, 0, 0);
|
|
|
|
|
|
}
|
2022-04-21 12:48:20 +08:00
|
|
|
|
|
2022-04-21 13:02:35 +08:00
|
|
|
|
#if defined LOCALHOSTS_SWITCH
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
2022-04-21 12:48:20 +08:00
|
|
|
|
std::string DNFTOOL::GetIP()
|
|
|
|
|
|
{
|
|
|
|
|
|
httplib::SSLClient Tencword("docs.qq.com");
|
|
|
|
|
|
|
|
|
|
|
|
std::string body;
|
|
|
|
|
|
auto res = Tencword.Get("/doc/DQ1dGbVpzTkZDVlhY",
|
|
|
|
|
|
[&](const char* data, size_t data_length) {
|
|
|
|
|
|
body.append(data, data_length);
|
|
|
|
|
|
return true;
|
|
|
|
|
|
});
|
|
|
|
|
|
int strat_index = body.find("Yosin_Ip:");
|
|
|
|
|
|
int end_index = body.find("Yosin_IP");
|
|
|
|
|
|
|
|
|
|
|
|
if (strat_index != -1 && end_index != -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::string rqip = body.substr(strat_index + 9, end_index - (strat_index + 9));
|
|
|
|
|
|
return rqip;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
return GetIP();
|
|
|
|
|
|
}
|
2022-04-21 13:02:35 +08:00
|
|
|
|
#endif
|
2022-04-21 12:48:20 +08:00
|
|
|
|
|
|
|
|
|
|
void DNFTOOL::Wchar_tToString(std::string& szDst, wchar_t* wchar)
|
|
|
|
|
|
{
|
|
|
|
|
|
wchar_t* wText = wchar;
|
|
|
|
|
|
DWORD dwNum = WideCharToMultiByte(CP_OEMCP, NULL, wText, -1, NULL, 0, NULL, FALSE);// WideCharToMultiByte<74><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
char* psText; // psTextΪchar*<2A><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>飬<EFBFBD><E9A3AC>Ϊ<EFBFBD><CEAA>ֵ<EFBFBD><D6B5>std::string<6E><67><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
psText = new char[dwNum];
|
|
|
|
|
|
WideCharToMultiByte(CP_OEMCP, NULL, wText, -1, psText, dwNum, NULL, FALSE);// WideCharToMultiByte<74><65><EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
szDst = psText;// std::string<6E><67>ֵ
|
|
|
|
|
|
delete[]psText;// psText<78><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
}
|
2022-04-22 02:16:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const wchar_t* DNFTOOL::GetWC(const char* c)
|
|
|
|
|
|
{
|
|
|
|
|
|
const size_t cSize = strlen(c) + 1;
|
|
|
|
|
|
wchar_t* wc = new wchar_t[cSize];
|
|
|
|
|
|
mbstowcs(wc, c, cSize);
|
|
|
|
|
|
|
|
|
|
|
|
return wc;
|
|
|
|
|
|
}
|