[RELEASE]InGame MD5 protection

10/10/2013 14:20 TheBeast223#1

Explanation :
As you know, hacks like "dmg hack" or "x7 hack" are usualy epk and eix archives.
If you don't know how to crypt files or the encryption doesn't work well (it happens to me) you can't do almost nothing to stop those hacks.
So I created in python a little code which check files MD5 and if it's wrong the client will show an error and will close.

Before starting I want to tell you that : it's the first time for me in python (really :) ) so I think there may be performance complication so i suggest to check only the Indexes (.eix files) and the "Index" file because those are smaller. As I said it's my first time in python so I assume any mistake :)
Another thing : check your indent!

How it works? When it finds a file that is wrong it will display a message and after user click OK the client will close.
Image :
[Only registered and activated users can see links. Click Here To Register...]

Download link : [Only registered and activated users can see links. Click Here To Register...]
Virus total : [Only registered and activated users can see links. Click Here To Register...]

Tutorial :
Step 1 :
Unpack root. Open constinfo.py and add this :

Code:
## START FileCheck by Cataclismo (yeah ... TheBeast223 = Cataclismo @ pro-area.com = me :D )
FILECHECK_SEPARATOR = " ###md5: "
FILECHECK_MESSAGE = "Clientul are nevoie de update!!"
FILECHECK_URL = "http://digitalmt2.ro/files.md5"
## END FileCheck
Step 2:
Download the archive i post above and put all files from root from archive in your root and all the files from lib folder in your lib folder in client.

Step 3 :
In your root open intrologin.py with Notepad++ (or any other GOOD editor - avoid windows text editors) and search :
Code:
import uiScriptLocale
And add after :
Code:
import urllib
import md5
import threading
Step 4 :
Search in intrologin.py the code :
Code:
app.ShowCursor()
And add this BEFORE :
Code:
		t = threading.Thread(target=self.FileCheck(), args = (self))
		t.daemon = TRUE
		t.start()
And this add AFTER :
Code:
	def FileCheck(self):
		files = None
		md5_list = []
		files_list = []
		fname = "list.md5"
		data = None
		md5 = None
		## Download list
		urllib.urlretrieve (constInfo.FILECHECK_URL, fname)
		## Read list
		f = open(fname)
		files = f.readlines()
		f.close()
		## Clear list
		f = open(fname, "w")
		f.write("")
		f.close()
		## Split
		i = 0
		while i < len(files):
			data = files[i].split(constInfo.FILECHECK_SEPARATOR)
			files_list.append(data[0])
			md5_list.append(data[1])
			i += 1
		
		## Check files md5
		i = 0
		while i < len(files_list):
			md5 = self.md5_for_file(files_list[i])
			original_md5 = md5_list[i].lower()
			original_md5 = original_md5.replace(" ", "")
			original_md5 = original_md5.replace("\n", "")
			if md5 != original_md5:
				self.PopupNotifyMessage(constInfo.FILECHECK_MESSAGE, self.__ExitGame)
				break
			i += 1
		
	## File MD5 : 
	def md5_for_file(self, fname):
		f = open(fname, 'rb')
		data = f.read()
		m = md5.new()
		if len(data)>0:
			m.update(data)
			f.close()
			return m.hexdigest()
	##
Step 5 :
Create the list with files and md5 with a Patch Lister. If you don't have one use this : [Only registered and activated users can see links. Click Here To Register...]
Upload list and make shure the url is exactly like FILECHECK_URL!
The separator MUST be exactly like FILECHECK_SEPARATOR .
Ex: pack/root.eix ###md5: 123123123
###md5: is the separator

You can also edit the message from FILECHECK_MESSAGE.

If you followed my steps it have to work correctly.
Good luck!

OFF: Kunterica is a liar and a stealer! [Only registered and activated users can see links. Click Here To Register...] doesn't belong to him! It's maked by NistorAlex @ pro-area.com !
10/10/2013 14:27 Red Firestar#2
Nice Thanks I'll use it.
10/10/2013 14:30 xGr33n#3
Not bad, but with URLLIB. If your Webspace is offline the Client won`t work or?
10/10/2013 14:33 TheBeast223#4
Quote:
Originally Posted by xGr33n View Post
Not bad, but with URLLIB. If your Webspace is offline the Client won`t work or?
No... That's the idea...if they block website with antivirus just to use hacks!?
10/10/2013 15:09 Spartan#117#5
Clientside protection is always useless, because it can be manipulated in too many ways. Just redirect the http-request to another webserver where you have a modified md5-checksums file and the client will work because it only receives the manipulated file.
10/10/2013 15:17 TheBeast223#6
Quote:
Originally Posted by Spartan#117 View Post
Clientside protection is always useless, because it can be manipulated in too many ways. Just redirect the http-request to another webserver where you have a modified md5-checksums file and the client will work because it only receives the manipulated file.
Yeah... good minds cand manipulate it, but not everyone ;) ... they could also edit the intrologin.py, but as i said not everyone can do those things.
10/10/2013 16:10 Legend2007#7
Thanks for sharing the PY Modules.. mainly.. but either I have a different Idea of how a "thread" or "backgound thread" is supposed to work, or Your threading.py module doesn't work the way It should.

A separated thread from the main thread should never lock/freeze the main thread in any way, no matter how much work it needs to process, yet your thread module freezes the client everytime I run my filecheck.

And yes, I'm having it check all files, including the bigger EPK ones just to test it.
10/10/2013 16:31 TheBeast223#8
Quote:
Originally Posted by Legend2007 View Post
Thanks for sharing the PY Modules.. mainly.. but either I have a different Idea of how a "thread" or "backgound thread" is supposed to work, or Your threading.py module doesn't work the way It should.

A separated thread from the main thread should never lock/freeze the main thread in any way, no matter how much work it needs to process, yet your thread module freezes the client everytime I run my filecheck.

And yes, I'm having it check all files, including the bigger EPK ones just to test it.
Yeah, i know about threads, but I don't know how to make it work correctly. As I said it's the FIRST time when I work in python...
10/10/2013 17:15 JaPitole#9
Can you give patcher and lister?
10/11/2013 23:01 JaPitole#10
Can someone reupload patcher + lister from YouTube description?
10/11/2013 23:15 TheBeast223#11
[Only registered and activated users can see links. Click Here To Register...]
10/12/2013 08:27 HaveBeen™#12
I think so look at great but

1. Client lag if you're use to slow internet.
2. Client always waiting for connecting site If there isn't internet in his/her pc.. After error :\

You're a little develop this system :)

Meanwhile thanks dude :pimp:
10/12/2013 11:47 TheBeast223#13
Quote:
Originally Posted by HaveBeen™ View Post
I think so look at great but

1. Client lag if you're use to slow internet.
2. Client always waiting for connecting site If there isn't internet in his/her pc.. After error :\

You're a little develop this system :)

Meanwhile thanks dude :pimp:
1. It would have lag without my system too...
2. So? Without internet he wouldn't be able to play metin2 so there's no problem

WTF?!
10/12/2013 14:24 LovecKrys#14
Yesterday i made it by myself and today i find it here :D Fuck! :D
10/12/2013 14:28 TheBeast223#15
Quote:
Originally Posted by LovecKrys View Post
Yesterday i made it by myself and today i find it here :D Fuck! :D
Lol... :))