Jump to content

Client Protect - Checking Files with Size and MD5


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

5BAQb.png

I mention that all these functions are shit, we just did in a hurry, we have not tested, they are just tools to check code that do not have very bright but functional.

Someone wanted this and even more people from a certain conference, so I made this little tutorial.

 

These features give you the chance to check the following:
- To introduce reading a game DLL source automatically.
- To check the size of the DLL in question.
- To check more files in the client if that which corresponds md5 version of the file.

ffd:h -> http://pastebin.com/1TXW32Qu

 

Src/Client/UserInterface/Locale_inc.h

#define __ENABLE_DLL_CHECK__ // enable
#define __ENABLE_CHECK_SIZE__ // check size of files
#define __ENABLE_CHECK_MD5__ // check md5 of files
#define __SIZE_DLL__ 54200 // size in kb

Src/Client/UserInterface/UserInterface.cpp

#include "ffd.h" // Put file ffd.h in Extern/include/ 

 

#ifdef __ENABLE_DLL_CHECK__
int FunctionGetFileSize(char* FileName) {
	 HANDLE pFile_done = CreateFileA(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	 return FunctionGetFileSize(pFile_done, NULL);
	}
#endif

#ifdef __ENABLE_CHECK_MD5__
void FunctionGetFileMD5(char* cFile, char* hash) {
	MD5 ffd;

	if (strcmp(ffd.digestFile(cFile), hash)) {
		MessageBoxA(NULL, "It was detected a change to a file. Please do update the autopatcher!", "#System Error", NULL);
		exit(0);
	}
}
#endif

You can check this function in : 

 int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

 

#ifdef __ENABLE_DLL_CHECK__
	const char* keyName		= "name_your_dll";

	HINSTANCE hGetProcIDDLL = LoadLibrary(keyName + ".dll");
	
	if (hGetProcIDDLL == NULL) 
	{
		MessageBox(NULL, "The customer name can not start without dll_vegas.dll, please update your autopatcher.", "#System Error", MB_ICONSTOP);  
		return 0;
	}
#endif

#ifdef __ENABLE_CHECK_SIZE__
	if (FunctionGetFileSize(keyName + ".dll") != __SIZE_DLL__) //kb
	{
		MessageBox(NULL, "DLL has been changed, please update.", "#System Error", MB_ICONSTOP);   	
		return 0;
	}
#endif

 

#ifdef __ENABLE_CHECK_MD5__
	const char* MILES_key_MD5_Index_0	=	"miles/mssdsp.flt";
	const char* MILES_key_MD5_Index_0	=	"miles/msssoft.m3d";
	const char* MILES_key_MD5_Index_0	=	"miles/mssa3d.m3d";
	const char* MILES_key_MD5_Index_0	=	"miles/mss32.dll";
	
	const char* DLL_key_MD5_Index_0	=	"python27.dll";
	const char* DLL_key_MD5_Index_1	=	"mss32.dll";
	
	const char* LIB_key_MD5_Index_0	=	"ib/__future__.pyc";
	const char* LIB_key_MD5_Index_1	=	"lib/copy_reg.pyc";
	const char* LIB_key_MD5_Index_2	=	"lib/linecache.pyc";	
	const char* LIB_key_MD5_Index_3	=	"lib/ntpath.pyc";	
	const char* LIB_key_MD5_Index_4	=	"lib/os.pyc";	
	const char* LIB_key_MD5_Index_5	=	"lib/site.pyc";	
	const char* LIB_key_MD5_Index_6	=	"lib/stat.pyc";
	const char* LIB_key_MD5_Index_7	=	"lib/string.pyc";	
	const char* LIB_key_MD5_Index_8	=	"lib/traceback.pyc";	
	const char* LIB_key_MD5_Index_9	=	"lib/types.pyc";
	const char* LIB_key_MD5_Index_10	=	"lib/UserDict.pyc";		
	
	const char* Index_key_md5_	=	"pack/Index";	

	const char* PACK_key_MD5_Index_0	=	"pack/root.eix";	
	const char* PACK_key_MD5_Index_1	=	"pack/ETC.eix";
	const char* PACK_key_MD5_Index_2	=	"pack/locale_en.eix";			
	
		///////////// VERIFICATION PATCH MILES ///////////////////
	FunctionGetFileMD5(MILES_key_MD5_Index_0,"cb71b1791009eca618e9b1ad4baa4fa9");		
	FunctionGetFileMD5(MILES_key_MD5_Index_1,"bdc9ad58ade17dbd939522eee447416f");		
	FunctionGetFileMD5(MILES_key_MD5_Index_2,"e089ce52b0617a6530069f22e0bdba2a");
	FunctionGetFileMD5(MILES_key_MD5_Index_3,"6400e224b8b44ece59a992e6d8233719");
		///////////// VERIFICATION PATCH DLL ///////////////////
	FunctionGetFileMD5(DLL_key_MD5_Index_0,"d219c0a8aff2c771946d73554916bd9a");
	FunctionGetFileMD5(DLL_key_MD5_Index_1,"6400e224b8b44ece59a992e6d8233719");
		///////////// VERIFICATION PATCH LIB ///////////////////
	FunctionGetFileMD5(LIB_key_MD5_Index_0,"d2505c6e64dc44a1745dda0905f4e787");
	FunctionGetFileMD5(LIB_key_MD5_Index_1,"5e996d35b598676b253dd25fa3809ef2");
	FunctionGetFileMD5(LIB_key_MD5_Index_2,"c4c28529b05b4093f629fb7b23603cd2");
	FunctionGetFileMD5(LIB_key_MD5_Index_3,"966048f390a65bebf60f912845441110");
	FunctionGetFileMD5(LIB_key_MD5_Index_4,"9e1e72faaafcde16dfd0e643a31f0b74");
	FunctionGetFileMD5(LIB_key_MD5_Index_5,"8336371539a459e72d7110f0cb1ed84f");
	FunctionGetFileMD5(LIB_key_MD5_Index_6,"3dc2d3d11ba4c668a0097fbd631c7be6");
	FunctionGetFileMD5(LIB_key_MD5_Index_7,"39c29074226b2196e7f13ce93560d3d0");
	FunctionGetFileMD5(LIB_key_MD5_Index_8,"009e6647dfac211b6e69c6b3f1ed5600");
	FunctionGetFileMD5(LIB_key_MD5_Index_9,"2bff75340aa1d94b88bfc7915a291564");
	FunctionGetFileMD5(LIB_key_MD5_Index_10,"aabdd94dfe3a1b0092f0a414a935c091");
		///////////// VERIFICATION INDEX ///////////////////
	FunctionGetFileMD5(Index_key_md5_,"8823ca827dfc980798856e97f3568cef");
		///////////// VERIFICATION FILES PACK ///////////////////
	FunctionGetFileMD5(PACK_key_MD5_Index_0,"ce13b7c96f725b7d7c39cbe1ae2f8b4d");
	FunctionGetFileMD5(PACK_key_MD5_Index_1,"7c0b756d079a9c76a220a724b9594eeb");
	FunctionGetFileMD5(PACK_key_MD5_Index_2,"5b1aea18b89330481e16eca94673951c");
#endif	

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 17
  • kekw 2
  • Eyes 1
  • Dislove 1
  • Angry 1
  • Good 2
  • Love 21
Link to comment
Share on other sites

  • 1 month later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.