| 
									
										
										
										
											2022-02-03 19:20:05 +08:00
										 |  |  |  | // dllmain.cpp : 定义 DLL 应用程序的入口点。
 | 
					
						
							|  |  |  |  | #include "pch.h"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-03 22:25:03 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-06 11:33:52 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-14 23:35:11 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-21 12:56:05 +08:00
										 |  |  |  | #if defined LOCALHOSTS_SWITCH
 | 
					
						
							| 
									
										
										
										
											2022-02-10 14:14:08 +08:00
										 |  |  |  | void LenheartThread(void) | 
					
						
							| 
									
										
										
										
											2022-02-03 22:25:03 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2022-02-07 03:31:00 +08:00
										 |  |  |  |     //  下方写全局变量
 | 
					
						
							|  |  |  |  |     static int Nut头地址; | 
					
						
							|  |  |  |  |     static int 属性头地址; | 
					
						
							|  |  |  |  |     static int 可开始执行判断; | 
					
						
							| 
									
										
										
										
											2022-02-03 19:20:05 +08:00
										 |  |  |  |     while (true) | 
					
						
							|  |  |  |  |     { | 
					
						
							| 
									
										
										
										
											2022-02-10 14:14:08 +08:00
										 |  |  |  |         Sleep(10); | 
					
						
							| 
									
										
										
										
											2022-03-08 12:57:35 +08:00
										 |  |  |  |         if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 6)可开始执行判断 = 1; | 
					
						
							| 
									
										
										
										
											2022-03-16 10:03:39 +08:00
										 |  |  |  |         if (可开始执行判断 == 1)//选频道界面  游戏初始化完毕
 | 
					
						
							| 
									
										
										
										
											2022-02-03 22:25:03 +08:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2022-04-11 19:44:03 +08:00
										 |  |  |  |             //hook::InitGameScript();
 | 
					
						
							| 
									
										
										
										
											2022-02-03 22:25:03 +08:00
										 |  |  |  |             while (true) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Sleep(10); | 
					
						
							| 
									
										
										
										
											2022-03-08 12:57:35 +08:00
										 |  |  |  |                 if (DNFTOOL::GetExeNutWrtNum(61) != 0 && Nut头地址 == 0)Nut头地址 = DNFTOOL::GetExeNutWrtNum(61); | 
					
						
							| 
									
										
										
										
											2022-02-03 22:25:03 +08:00
										 |  |  |  |                 //if (GetExeNutWrtNum(61 != 0))属性头地址 = GetExeNutWrtNum(61);
 | 
					
						
							| 
									
										
										
										
											2022-03-08 12:57:35 +08:00
										 |  |  |  |                 if (DNFTOOL::GetExeNutWrtNum(0) == 666) | 
					
						
							| 
									
										
										
										
											2022-02-03 22:25:03 +08:00
										 |  |  |  |                 { | 
					
						
							|  |  |  |  |                     std::cout << u8"写成功" << std::endl;; | 
					
						
							| 
									
										
										
										
											2022-03-08 12:57:35 +08:00
										 |  |  |  |                     DNFTOOL::SetExeNutWrtNum(0, 0); | 
					
						
							|  |  |  |  |                     DNFTOOL::SetNutArrNum(Nut头地址 , 20, 0); | 
					
						
							| 
									
										
										
										
											2022-02-03 22:25:03 +08:00
										 |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-02-03 19:20:05 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-04-21 12:56:05 +08:00
										 |  |  |  | #else
 | 
					
						
							|  |  |  |  | void LenheartThread() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     static int 可开始执行判断; | 
					
						
							|  |  |  |  |     std::string Rqip = GetIP(); | 
					
						
							| 
									
										
										
										
											2022-02-03 19:20:05 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-21 12:56:05 +08:00
										 |  |  |  |     std::string MyIp; | 
					
						
							|  |  |  |  |     httplib::Client* IPCliObj = NULL;// http连接主体
 | 
					
						
							|  |  |  |  |     IPCliObj = new httplib::Client("ip.json-json.com");//初始化 http 对象
 | 
					
						
							|  |  |  |  |     auto res = IPCliObj->Get("/"); | 
					
						
							|  |  |  |  |     if (res->status == 200)//如果返回包正常
 | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         MyIp = res->body;//取得date      
 | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     while (true) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         Sleep(10); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 6)可开始执行判断 = 1; | 
					
						
							|  |  |  |  |         if (可开始执行判断 == 1) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             std::string ippack; | 
					
						
							|  |  |  |  |             int gameip = *(int*)0x1AE9CEC; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (gameip == 3735601) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ippack = MyIp; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 wchar_t* wgameip = (wchar_t*)0x1AE9CEC; | 
					
						
							|  |  |  |  |                 Wchar_tToString(ippack, wgameip); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             LenheartBase::CBASE64 bb; | 
					
						
							|  |  |  |  |             ippack += "nima"; | 
					
						
							|  |  |  |  |             std::string rsastring = bb.RsaPriEncrypt(ippack, Pri_key); | 
					
						
							|  |  |  |  |             std::string enstring = bb.encode(rsastring); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             httplib::Client* CliObj = NULL;// http连接主体
 | 
					
						
							|  |  |  |  |             CliObj = new httplib::Client(Rqip + ":9007");//初始化 http 对象
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             httplib::Params ParamsObj;//新建 Params 对象
 | 
					
						
							|  |  |  |  |             ParamsObj.emplace("zz", enstring.c_str());//加入账号数据进数据包
 | 
					
						
							|  |  |  |  |             auto res = CliObj->Post("/zz", ParamsObj); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (res->status == 200)//如果返回包正常
 | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 //res->status;
 | 
					
						
							|  |  |  |  |                 std::string date = res->body;//取得date
 | 
					
						
							|  |  |  |  |                 std::string base64code = bb.decode(date); | 
					
						
							|  |  |  |  |                 std::string decrypt_text = bb.RsaPriDecrypt(base64code, Pri_key); | 
					
						
							|  |  |  |  |                 long long redate = atoll(decrypt_text.c_str()) / 1000; | 
					
						
							|  |  |  |  |                 time_t myt = time(0); | 
					
						
							|  |  |  |  |                 long long nowdate = (long long)myt; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 __int64 absnum = abs(nowdate - redate); | 
					
						
							|  |  |  |  |                 if (absnum < 18000) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     //RegisterNut();
 | 
					
						
							|  |  |  |  |                     //RunNut();
 | 
					
						
							|  |  |  |  |                     hook::InitGameScript(); | 
					
						
							|  |  |  |  |                     while (true) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         Sleep(16000); | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     ExitProcess(0); | 
					
						
							|  |  |  |  |                     break; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ExitProcess(0); | 
					
						
							|  |  |  |  |                 break; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | #endif
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-06 20:11:13 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-03 19:20:05 +08:00
										 |  |  |  | __declspec(dllexport) void Lenheart() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     DWORD threadID; | 
					
						
							| 
									
										
										
										
											2022-02-10 14:14:08 +08:00
										 |  |  |  |     CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)LenheartThread, NULL, 0, &threadID); | 
					
						
							| 
									
										
										
										
											2022-03-06 20:11:13 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-03 19:20:05 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | BOOL APIENTRY DllMain( HMODULE hModule, | 
					
						
							|  |  |  |  |                        DWORD  ul_reason_for_call, | 
					
						
							|  |  |  |  |                        LPVOID lpReserved | 
					
						
							|  |  |  |  |                      ) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     switch (ul_reason_for_call) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |     case DLL_PROCESS_ATTACH: | 
					
						
							| 
									
										
										
										
											2022-03-08 12:57:35 +08:00
										 |  |  |  |         //Sleep(5000);
 | 
					
						
							|  |  |  |  |         //std::cout << HOOK() << std::endl;
 | 
					
						
							|  |  |  |  |         hook::RegisterHook(); | 
					
						
							| 
									
										
										
										
											2022-02-03 19:20:05 +08:00
										 |  |  |  |         Lenheart(); | 
					
						
							| 
									
										
										
										
											2022-02-10 14:14:08 +08:00
										 |  |  |  |         break; | 
					
						
							| 
									
										
										
										
											2022-02-03 19:20:05 +08:00
										 |  |  |  |     case DLL_THREAD_ATTACH: | 
					
						
							|  |  |  |  |     case DLL_THREAD_DETACH: | 
					
						
							|  |  |  |  |     case DLL_PROCESS_DETACH: | 
					
						
							|  |  |  |  |         break; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     return TRUE; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 |