Jump to content

Simple Anti Cheat with Python


Recommended Posts

  • Silver

M2 Download Center

This is the hidden content, please
( Internal )

Hello my own use simple anti cheat protection like enigma;

 

What u need?

  1. Simple php file for logging
  2. Win32modules for 2.2 or 2.7
  3. and badlist.php(
    This is the hidden content, please
    )
  4. and secur.dll(
    This is the hidden content, please
    )
What this Functions:
  1. Base protection > Name + Byte
  2. Folder Secuirty > BGM + Miles + Lib + Main Folder
  3. Folder Check > ".py" + ".mix" + ".m3d" + ".bat" + ".flt" + ".asi"
  4. Hash Check > Miles folder, python core, security base dll, os.pyc(for baseinit methode)
  5. TaskList Check
  6. Windows Check
Script;
import sys
import os
import app
import time
import thread
import dbg
import ui
import md5
import urllib
import uiCommon
from os.path import basename

try:
	import win32api	
except:
	syslog('Cant import win32api module')
	dbg.LogBox("Cant import win32api module")
	app.Exit()

DATA_URL = "http://koray.zz.mu/imtn2/client/"

launchername = sys.executable
taskname = basename(launchername)
launchers = os.path.getsize(taskname)
launchersize = int(launchers)

check=' '.join(os.listdir(os.getcwd()))
check_miles=' '.join(os.listdir(os.getcwd()+"miles"))
check_bgm=' '.join(os.listdir(os.getcwd()+"bgm"))
check_lib=' '.join(os.listdir(os.getcwd()+"lib"))
check_folder=' '.join(os.listdir(os.getcwd()))

######preparation#################################

##HashFonk
def getMd5(file):
	m = md5.new()
	fp = open(file,"rb")
	while 1:
		data = fp.read(1024)
		if not data:break
		m.update(data)
	fp.close()
	return m.hexdigest()
def getMD5ByFileName(file):
	try:
		file = file.strip()
		md5hash = md5.new()
		dllFile = open(file, 'rb')
		tmpFileBlock = dllFile.read()
		dllFile.close()
		md5hash.update(tmpFileBlock)
		md5hash = md5hash.hexdigest()
		return md5hash
	except:
		return ''
def ReturnMd5(file,hash):
	if(getMd5(file) != hash ):return TRUE
	else:return FALSE
def syslog(s):
	file = open('syserr.txt', 'a')
	file.write('n' + s + 'n')
	file.close()
def ingameNotifyPopupAndExit(text = ''):
	popup = uiCommon.PopupDialog()
	popup.SetWidth(700)
	popup.SetText(text)
	popup.Show()
	time.sleep(7)
###/////////######################################

#Base Security > Name+Byte
def BaseCheck():
	global launchername, taskname, launchersize
	
	if not taskname == "metin2cliento.exe" or launchersize == "3171985":
		dbg.LogBox("Wrong launcher")
		os.system("taskkill /im %s /f" % taskname)
		
#Folder Secuirty > BGM + Miles + Lib + Main Folder
def FileCheck():
	global check, check_bgm, check_folder, check_miles, check_lib

	banned_ext=[".mix", ".m3d", ".flt", ".asi", ".bat"]
	miles_clean=["mssa3d.m3d", "mssds3d.m3d", "mssdsp.flt", "mssdx7.m3d", "msseax.m3d", "mssmp3.asi", "mssrsx.m3d", "msssoft.m3d", "mssvoice.asi"]
	lib_clean=['__future__.pyc','copy_reg.pyc','linecache.pyc','ntpath.pyc','os.pyc','site.pyc','stat.pyc','string.pyc','traceback.pyc','types.pyc','UserDict.pyc','urllib.pyc','win32con.pyc','threading.pyc']
	folder_clean=['BGM', 'artpclnt.dll', 'pn.dll', 'channel.inf', 'config.exe', 'devil.dll', 'DSETUP.dll', 'errorlog.exe', 'errorlog.txt', 'granny2.dll', 'ijl15.dll', 'ilu.dll', 'locale.cfg', 'metin2cliento.exe', 'metin2.cfg', 'mouse.cfg', 'mscoree.dll', 'MSS32.DLL', 'msvcp60.dll', 'MSVCRTD.DLL', 'patchw32.dll', 'python22.dll', 'SpeedTreeRT.dll', 'syserr.txt', 'unicows.dll', 'hshield', 'lib', 'mark', 'miles', 'pack', 'temp', 'upload', 'patchskin', 'skins', 'screenshot']
	bgm_clean=['a_rhapsody_of_war.mp3','another_way.mp3','back_to_back.mp3','blacksea.mp3','catacomb_of_devil.mp3','characterselect.mp3','death_of_landmark.mp3','desert.mp3','enter_the_east.mp3','follow_war_god.mp3','last-war2.mp3','login_window.mp3','lost_my_name.mp3','m2bg.mp3','misty_forest.mp3','monkey_temple.mp3','mountain_of_death.mp3','mt.mp3','only_my_battle.mp3','open_the_gate.mp3','save_me.mp3','wedding.mp3','wonderland.mp3','xmas.mp3']

	for i in miles_clean:
		check_miles=check_miles.replace(i, '')
	for i in lib_clean:
		check_lib=check_lib.replace(i, '')
	for i in bgm_clean:
		check_bgm=check_bgm.replace(i, '')
	for i in folder_clean:
		check_folder=check_folder.replace(i, '')
	for i in banned_ext:
		if check.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_bgm.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_miles.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_lib.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_folder.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
#Folder check > ".py"			
def PyDelete():
	while 1 == 1:
		files = [f for f in os.listdir('.') if os.path.isfile(f)]
		for f in files:
			if f.endswith(".py"):
				f1 = f
				try:
					os.remove(f)
				except:
					pass

				if f1 == "logininfo.py":
					syslog("[HACKSHIELD]Detected Hack File")
					app.Exit("")
		time.sleep(1)
		
#######Hash Control
def HashCheck():
	##Miles
	if len(os.listdir('miles')) != 10 :
		return 'Wrong file detected'
	d = {
		'miles/mss32.dll': '6400e224b8b44ece59a992e6d8233719',
		'miles/mssa3d.m3d':'e089ce52b0617a6530069f22e0bdba2a', 
		'miles/mssds3d.m3d':'85267776d45dbf5475c7d9882f08117c',
		'miles/mssdsp.flt':'cb71b1791009eca618e9b1ad4baa4fa9',
		'miles/mssdx7.m3d':'2727e2671482a55b2f1f16aa88d2780f',
		'miles/msseax.m3d':'788bd950efe89fa5166292bd6729fa62',
		'miles/mssmp3.asi':'189576dfe55af3b70db7e3e2312cd0fd',
		'miles/mssrsx.m3d':'7fae15b559eb91f491a5f75cfa103cd4',
		'miles/msssoft.m3d':'bdc9ad58ade17dbd939522eee447416f',
		'miles/mssvoice.asi':'3d5342edebe722748ace78c930f4d8a5'
		}
	for x in d:
		if ReturnMd5(x, d[x]): return TRUE
		else: return FALSE
				
	if getMd5("python22.dll") != "97FB91610702B63F071282E9CF86B8C0" :
		dbg.LogBox("Invaild file:" + "python22.dll")
		app.Exit()
	if getMd5("secur.dll") != "F01C8F12DD4662F566433B6DA1B2735E" :
		dbg.LogBox("Invaild file:" + "secur.dll")
		app.Exit()
	if getMd5("lib/os.pyc") != "d0d09c7daa9d57373cd7586a74ec4099" :
		dbg.LogBox("Invaild file:" + "os.pyc")
		app.Exit()

##CheckProcess
def ProcCheck():
	whitelist = ["putty.exe","filezilla.exe"]
	hack = []
	result = []
	
	while 1==1:
		for l in os.popen("secur.dll "+ str(os.getpid())).readlines():
			line = l.lower()
			if (line.find("switch") != -1 or line.find("hack") != -1 or line.find("inject") != -1  or line.find("bot") != -1 or 
				line.find("loader") != -1 or line.find("lalaker") != -1 or line.find("hile") != -1):
					urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])
					time.sleep(5)
					break
		for line in os.popen('secur.dll ' + str(os.getpid())).readlines():
			try:
				if line.strip() != '' and line.strip().startswith('EXE'):
					line = line.split(' ')
					line.pop(0)
					line.pop(0)
					line = ' '.join(line)
					f = open(line.strip(), 'r')
					if f:
						result.append(line.strip())
			except:
				continue
		return []
		for p in os.popen("tasklist v"):
			processi = p.read().lower()
			if (processi.find("hack") != -1 or processi.find("inject") != -1 or processi.find("inject") != -1  or 
				processi.find("bot") != -1 or processi.find("cheat") != -1 or processi.find("ollydbg") != -1 or 
				processi.find("actool") != -1 or processi.find("allydbg") != -1 or processi.find("ollyice") != -1 or 
				processi.find("windbg") != -1 or processi.find("softice") != -1 or processi.find("m2bob") != -1):
				p = processi.split()
				if p[0] in whitelist: 
					continue
					time.sleep(4)
				if p[0] not in hack:
					urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])
					time.sleep(5)
		time.sleep(20)
	return
FileCheck()
BaseCheck()
HashCheck()

thread.start_new_thread(PyDelete, ())
thread.start_new_thread(ProcCheck, ())

regards

  • Metin2 Dev 19
  • Dislove 1
  • Think 2
  • Good 9
  • Love 18
Link to comment
Share on other sites

What do you mean by:

1. Base protection > Name + Byte?

 

Also:

You are importing win32api module but you don't use it anywhere.

You don't use the def downloadBadWordsList at all, so what's the point of keeping it there?

 

And one last thing:

urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])

If someone finds this string he/she could send fake hack reports and then innocent people will be banned for nothing

  • Metin2 Dev 2
  • muscle 1
  • Love 5
Link to comment
Share on other sites

  • Silver

What do you mean by:

1. Base protection > Name + Byte?

 

Also:

You are importing win32api module but you don't use it anywhere.

You don't use the def downloadBadWordsList at all, so what's the point of keeping it there?

 

And one last thing:

urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])
If someone finds this string he/she could send fake hack reports and then innocent people will be banned for nothing

 

Name and byte check for game launcher

def syslog func use win module

I forget remove to downloadbadwordlist :D

 

this method for <40k users because no more than an alternative, this only log table so help to gm

 

Link to comment
Share on other sites

 

What do you mean by:

1. Base protection > Name + Byte?

 

Also:

You are importing win32api module but you don't use it anywhere.

You don't use the def downloadBadWordsList at all, so what's the point of keeping it there?

 

And one last thing:

urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])

If someone finds this string he/she could send fake hack reports and then innocent people will be banned for nothing

 

Name and byte check for game launcher

def syslog func use win module

I forget remove to downloadbadwordlist :D

 

this method for <40k users because no more than an alternative, this only log table so help to gm

 

def syslog(s):
      file = open('syserr.txt', 'a')
      file.write('n' + s + 'n')
      file.close()

It doesn't need win32api,you can try and see

Anyway thanks for sharing

 

  • Love 2
Link to comment
Share on other sites

Hello my own use simple anti cheat protection like enigma;

 

What u need?

  1. Simple php file for logging
  2. Win32modules for 2.2 or 2.7
  3. and badlist.php(
    This is the hidden content, please
    )
  4. and secur.dll(
    This is the hidden content, please
    )
What this Functions:
  1. Base protection > Name + Byte
  2. Folder Secuirty > BGM + Miles + Lib + Main Folder
  3. Folder Check > ".py" + ".mix" + ".m3d" + ".bat" + ".flt" + ".asi"
  4. Hash Check > Miles folder, python core, security base dll, os.pyc(for baseinit methode)
  5. TaskList Check
  6. Windows Check
Script;
import sys
import os
import app
import time
import thread
import dbg
import ui
import md5
import urllib
import uiCommon
from os.path import basename

try:
	import win32api	
except:
	syslog('Cant import win32api module')
	dbg.LogBox("Cant import win32api module")
	app.Exit()

DATA_URL = "http://koray.zz.mu/imtn2/client/"

launchername = sys.executable
taskname = basename(launchername)
launchers = os.path.getsize(taskname)
launchersize = int(launchers)

check=' '.join(os.listdir(os.getcwd()))
check_miles=' '.join(os.listdir(os.getcwd()+"miles"))
check_bgm=' '.join(os.listdir(os.getcwd()+"bgm"))
check_lib=' '.join(os.listdir(os.getcwd()+"lib"))
check_folder=' '.join(os.listdir(os.getcwd()))

######preparation#################################

##HashFonk
def getMd5(file):
	m = md5.new()
	fp = open(file,"rb")
	while 1:
		data = fp.read(1024)
		if not data:break
		m.update(data)
	fp.close()
	return m.hexdigest()
def getMD5ByFileName(file):
	try:
		file = file.strip()
		md5hash = md5.new()
		dllFile = open(file, 'rb')
		tmpFileBlock = dllFile.read()
		dllFile.close()
		md5hash.update(tmpFileBlock)
		md5hash = md5hash.hexdigest()
		return md5hash
	except:
		return ''
def ReturnMd5(file,hash):
	if(getMd5(file) != hash ):return TRUE
	else:return FALSE
def syslog(s):
	file = open('syserr.txt', 'a')
	file.write('n' + s + 'n')
	file.close()
def ingameNotifyPopupAndExit(text = ''):
	popup = uiCommon.PopupDialog()
	popup.SetWidth(700)
	popup.SetText(text)
	popup.Show()
	time.sleep(7)
###/////////######################################

#Base Security > Name+Byte
def BaseCheck():
	global launchername, taskname, launchersize
	
	if not taskname == "metin2cliento.exe" or launchersize == "3171985":
		dbg.LogBox("Wrong launcher")
		os.system("taskkill /im %s /f" % taskname)
		
#Folder Secuirty > BGM + Miles + Lib + Main Folder
def FileCheck():
	global check, check_bgm, check_folder, check_miles, check_lib

	banned_ext=[".mix", ".m3d", ".flt", ".asi", ".bat"]
	miles_clean=["mssa3d.m3d", "mssds3d.m3d", "mssdsp.flt", "mssdx7.m3d", "msseax.m3d", "mssmp3.asi", "mssrsx.m3d", "msssoft.m3d", "mssvoice.asi"]
	lib_clean=['__future__.pyc','copy_reg.pyc','linecache.pyc','ntpath.pyc','os.pyc','site.pyc','stat.pyc','string.pyc','traceback.pyc','types.pyc','UserDict.pyc','urllib.pyc','win32con.pyc','threading.pyc']
	folder_clean=['BGM', 'artpclnt.dll', 'pn.dll', 'channel.inf', 'config.exe', 'devil.dll', 'DSETUP.dll', 'errorlog.exe', 'errorlog.txt', 'granny2.dll', 'ijl15.dll', 'ilu.dll', 'locale.cfg', 'metin2cliento.exe', 'metin2.cfg', 'mouse.cfg', 'mscoree.dll', 'MSS32.DLL', 'msvcp60.dll', 'MSVCRTD.DLL', 'patchw32.dll', 'python22.dll', 'SpeedTreeRT.dll', 'syserr.txt', 'unicows.dll', 'hshield', 'lib', 'mark', 'miles', 'pack', 'temp', 'upload', 'patchskin', 'skins', 'screenshot']
	bgm_clean=['a_rhapsody_of_war.mp3','another_way.mp3','back_to_back.mp3','blacksea.mp3','catacomb_of_devil.mp3','characterselect.mp3','death_of_landmark.mp3','desert.mp3','enter_the_east.mp3','follow_war_god.mp3','last-war2.mp3','login_window.mp3','lost_my_name.mp3','m2bg.mp3','misty_forest.mp3','monkey_temple.mp3','mountain_of_death.mp3','mt.mp3','only_my_battle.mp3','open_the_gate.mp3','save_me.mp3','wedding.mp3','wonderland.mp3','xmas.mp3']

	for i in miles_clean:
		check_miles=check_miles.replace(i, '')
	for i in lib_clean:
		check_lib=check_lib.replace(i, '')
	for i in bgm_clean:
		check_bgm=check_bgm.replace(i, '')
	for i in folder_clean:
		check_folder=check_folder.replace(i, '')
	for i in banned_ext:
		if check.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_bgm.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_miles.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_lib.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_folder.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
#Folder check > ".py"			
def PyDelete():
	while 1 == 1:
		files = [f for f in os.listdir('.') if os.path.isfile(f)]
		for f in files:
			if f.endswith(".py"):
				f1 = f
				try:
					os.remove(f)
				except:
					pass

				if f1 == "logininfo.py":
					syslog("[HACKSHIELD]Detected Hack File")
					app.Exit("")
		time.sleep(1)
		
#######Hash Control
def HashCheck():
	##Miles
	if len(os.listdir('miles')) != 10 :
		return 'Wrong file detected'
	d = {
		'miles/mss32.dll': '6400e224b8b44ece59a992e6d8233719',
		'miles/mssa3d.m3d':'e089ce52b0617a6530069f22e0bdba2a', 
		'miles/mssds3d.m3d':'85267776d45dbf5475c7d9882f08117c',
		'miles/mssdsp.flt':'cb71b1791009eca618e9b1ad4baa4fa9',
		'miles/mssdx7.m3d':'2727e2671482a55b2f1f16aa88d2780f',
		'miles/msseax.m3d':'788bd950efe89fa5166292bd6729fa62',
		'miles/mssmp3.asi':'189576dfe55af3b70db7e3e2312cd0fd',
		'miles/mssrsx.m3d':'7fae15b559eb91f491a5f75cfa103cd4',
		'miles/msssoft.m3d':'bdc9ad58ade17dbd939522eee447416f',
		'miles/mssvoice.asi':'3d5342edebe722748ace78c930f4d8a5'
		}
	for x in d:
		if ReturnMd5(x, d[x]): return TRUE
		else: return FALSE
				
	if getMd5("python22.dll") != "97FB91610702B63F071282E9CF86B8C0" :
		dbg.LogBox("Invaild file:" + "python22.dll")
		app.Exit()
	if getMd5("secur.dll") != "F01C8F12DD4662F566433B6DA1B2735E" :
		dbg.LogBox("Invaild file:" + "secur.dll")
		app.Exit()
	if getMd5("lib/os.pyc") != "d0d09c7daa9d57373cd7586a74ec4099" :
		dbg.LogBox("Invaild file:" + "os.pyc")
		app.Exit()

##CheckProcess
def ProcCheck():
	whitelist = ["putty.exe","filezilla.exe"]
	hack = []
	result = []
	
	while 1==1:
		for l in os.popen("secur.dll "+ str(os.getpid())).readlines():
			line = l.lower()
			if (line.find("switch") != -1 or line.find("hack") != -1 or line.find("inject") != -1  or line.find("bot") != -1 or 
				line.find("loader") != -1 or line.find("lalaker") != -1 or line.find("hile") != -1):
					urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])
					time.sleep(5)
					break
		for line in os.popen('secur.dll ' + str(os.getpid())).readlines():
			try:
				if line.strip() != '' and line.strip().startswith('EXE'):
					line = line.split(' ')
					line.pop(0)
					line.pop(0)
					line = ' '.join(line)
					f = open(line.strip(), 'r')
					if f:
						result.append(line.strip())
			except:
				continue
		return []
		for p in os.popen("tasklist v"):
			processi = p.read().lower()
			if (processi.find("hack") != -1 or processi.find("inject") != -1 or processi.find("inject") != -1  or 
				processi.find("bot") != -1 or processi.find("cheat") != -1 or processi.find("ollydbg") != -1 or 
				processi.find("actool") != -1 or processi.find("allydbg") != -1 or processi.find("ollyice") != -1 or 
				processi.find("windbg") != -1 or processi.find("softice") != -1 or processi.find("m2bob") != -1):
				p = processi.split()
				if p[0] in whitelist: 
					continue
					time.sleep(4)
				if p[0] not in hack:
					urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])
					time.sleep(5)
		time.sleep(20)
	return
FileCheck()
BaseCheck()
HashCheck()

thread.start_new_thread(PyDelete, ())
thread.start_new_thread(ProcCheck, ())

regards

Thank you, nice work :-)

  • Metin2 Dev 1
  • Love 1
Link to comment
Share on other sites

 

Hello my own use simple anti cheat protection like enigma;

 

What u need?

  1. Simple php file for logging
  2. Win32modules for 2.2 or 2.7
  3. and badlist.php(
    This is the hidden content, please
    )
  4. and secur.dll(
    This is the hidden content, please
    )
What this Functions:
  1. Base protection > Name + Byte
  2. Folder Secuirty > BGM + Miles + Lib + Main Folder
  3. Folder Check > ".py" + ".mix" + ".m3d" + ".bat" + ".flt" + ".asi"
  4. Hash Check > Miles folder, python core, security base dll, os.pyc(for baseinit methode)
  5. TaskList Check
  6. Windows Check
Script;
import sys
import os
import app
import time
import thread
import dbg
import ui
import md5
import urllib
import uiCommon
from os.path import basename

try:
	import win32api	
except:
	syslog('Cant import win32api module')
	dbg.LogBox("Cant import win32api module")
	app.Exit()

DATA_URL = "http://koray.zz.mu/imtn2/client/"

launchername = sys.executable
taskname = basename(launchername)
launchers = os.path.getsize(taskname)
launchersize = int(launchers)

check=' '.join(os.listdir(os.getcwd()))
check_miles=' '.join(os.listdir(os.getcwd()+"miles"))
check_bgm=' '.join(os.listdir(os.getcwd()+"bgm"))
check_lib=' '.join(os.listdir(os.getcwd()+"lib"))
check_folder=' '.join(os.listdir(os.getcwd()))

######preparation#################################

##HashFonk
def getMd5(file):
	m = md5.new()
	fp = open(file,"rb")
	while 1:
		data = fp.read(1024)
		if not data:break
		m.update(data)
	fp.close()
	return m.hexdigest()
def getMD5ByFileName(file):
	try:
		file = file.strip()
		md5hash = md5.new()
		dllFile = open(file, 'rb')
		tmpFileBlock = dllFile.read()
		dllFile.close()
		md5hash.update(tmpFileBlock)
		md5hash = md5hash.hexdigest()
		return md5hash
	except:
		return ''
def ReturnMd5(file,hash):
	if(getMd5(file) != hash ):return TRUE
	else:return FALSE
def syslog(s):
	file = open('syserr.txt', 'a')
	file.write('n' + s + 'n')
	file.close()
def ingameNotifyPopupAndExit(text = ''):
	popup = uiCommon.PopupDialog()
	popup.SetWidth(700)
	popup.SetText(text)
	popup.Show()
	time.sleep(7)
###/////////######################################

#Base Security > Name+Byte
def BaseCheck():
	global launchername, taskname, launchersize
	
	if not taskname == "metin2cliento.exe" or launchersize == "3171985":
		dbg.LogBox("Wrong launcher")
		os.system("taskkill /im %s /f" % taskname)
		
#Folder Secuirty > BGM + Miles + Lib + Main Folder
def FileCheck():
	global check, check_bgm, check_folder, check_miles, check_lib

	banned_ext=[".mix", ".m3d", ".flt", ".asi", ".bat"]
	miles_clean=["mssa3d.m3d", "mssds3d.m3d", "mssdsp.flt", "mssdx7.m3d", "msseax.m3d", "mssmp3.asi", "mssrsx.m3d", "msssoft.m3d", "mssvoice.asi"]
	lib_clean=['__future__.pyc','copy_reg.pyc','linecache.pyc','ntpath.pyc','os.pyc','site.pyc','stat.pyc','string.pyc','traceback.pyc','types.pyc','UserDict.pyc','urllib.pyc','win32con.pyc','threading.pyc']
	folder_clean=['BGM', 'artpclnt.dll', 'pn.dll', 'channel.inf', 'config.exe', 'devil.dll', 'DSETUP.dll', 'errorlog.exe', 'errorlog.txt', 'granny2.dll', 'ijl15.dll', 'ilu.dll', 'locale.cfg', 'metin2cliento.exe', 'metin2.cfg', 'mouse.cfg', 'mscoree.dll', 'MSS32.DLL', 'msvcp60.dll', 'MSVCRTD.DLL', 'patchw32.dll', 'python22.dll', 'SpeedTreeRT.dll', 'syserr.txt', 'unicows.dll', 'hshield', 'lib', 'mark', 'miles', 'pack', 'temp', 'upload', 'patchskin', 'skins', 'screenshot']
	bgm_clean=['a_rhapsody_of_war.mp3','another_way.mp3','back_to_back.mp3','blacksea.mp3','catacomb_of_devil.mp3','characterselect.mp3','death_of_landmark.mp3','desert.mp3','enter_the_east.mp3','follow_war_god.mp3','last-war2.mp3','login_window.mp3','lost_my_name.mp3','m2bg.mp3','misty_forest.mp3','monkey_temple.mp3','mountain_of_death.mp3','mt.mp3','only_my_battle.mp3','open_the_gate.mp3','save_me.mp3','wedding.mp3','wonderland.mp3','xmas.mp3']

	for i in miles_clean:
		check_miles=check_miles.replace(i, '')
	for i in lib_clean:
		check_lib=check_lib.replace(i, '')
	for i in bgm_clean:
		check_bgm=check_bgm.replace(i, '')
	for i in folder_clean:
		check_folder=check_folder.replace(i, '')
	for i in banned_ext:
		if check.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_bgm.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_miles.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_lib.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_folder.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
#Folder check > ".py"			
def PyDelete():
	while 1 == 1:
		files = [f for f in os.listdir('.') if os.path.isfile(f)]
		for f in files:
			if f.endswith(".py"):
				f1 = f
				try:
					os.remove(f)
				except:
					pass

				if f1 == "logininfo.py":
					syslog("[HACKSHIELD]Detected Hack File")
					app.Exit("")
		time.sleep(1)
		
#######Hash Control
def HashCheck():
	##Miles
	if len(os.listdir('miles')) != 10 :
		return 'Wrong file detected'
	d = {
		'miles/mss32.dll': '6400e224b8b44ece59a992e6d8233719',
		'miles/mssa3d.m3d':'e089ce52b0617a6530069f22e0bdba2a', 
		'miles/mssds3d.m3d':'85267776d45dbf5475c7d9882f08117c',
		'miles/mssdsp.flt':'cb71b1791009eca618e9b1ad4baa4fa9',
		'miles/mssdx7.m3d':'2727e2671482a55b2f1f16aa88d2780f',
		'miles/msseax.m3d':'788bd950efe89fa5166292bd6729fa62',
		'miles/mssmp3.asi':'189576dfe55af3b70db7e3e2312cd0fd',
		'miles/mssrsx.m3d':'7fae15b559eb91f491a5f75cfa103cd4',
		'miles/msssoft.m3d':'bdc9ad58ade17dbd939522eee447416f',
		'miles/mssvoice.asi':'3d5342edebe722748ace78c930f4d8a5'
		}
	for x in d:
		if ReturnMd5(x, d[x]): return TRUE
		else: return FALSE
				
	if getMd5("python22.dll") != "97FB91610702B63F071282E9CF86B8C0" :
		dbg.LogBox("Invaild file:" + "python22.dll")
		app.Exit()
	if getMd5("secur.dll") != "F01C8F12DD4662F566433B6DA1B2735E" :
		dbg.LogBox("Invaild file:" + "secur.dll")
		app.Exit()
	if getMd5("lib/os.pyc") != "d0d09c7daa9d57373cd7586a74ec4099" :
		dbg.LogBox("Invaild file:" + "os.pyc")
		app.Exit()

##CheckProcess
def ProcCheck():
	whitelist = ["putty.exe","filezilla.exe"]
	hack = []
	result = []
	
	while 1==1:
		for l in os.popen("secur.dll "+ str(os.getpid())).readlines():
			line = l.lower()
			if (line.find("switch") != -1 or line.find("hack") != -1 or line.find("inject") != -1  or line.find("bot") != -1 or 
				line.find("loader") != -1 or line.find("lalaker") != -1 or line.find("hile") != -1):
					urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])
					time.sleep(5)
					break
		for line in os.popen('secur.dll ' + str(os.getpid())).readlines():
			try:
				if line.strip() != '' and line.strip().startswith('EXE'):
					line = line.split(' ')
					line.pop(0)
					line.pop(0)
					line = ' '.join(line)
					f = open(line.strip(), 'r')
					if f:
						result.append(line.strip())
			except:
				continue
		return []
		for p in os.popen("tasklist v"):
			processi = p.read().lower()
			if (processi.find("hack") != -1 or processi.find("inject") != -1 or processi.find("inject") != -1  or 
				processi.find("bot") != -1 or processi.find("cheat") != -1 or processi.find("ollydbg") != -1 or 
				processi.find("actool") != -1 or processi.find("allydbg") != -1 or processi.find("ollyice") != -1 or 
				processi.find("windbg") != -1 or processi.find("softice") != -1 or processi.find("m2bob") != -1):
				p = processi.split()
				if p[0] in whitelist: 
					continue
					time.sleep(4)
				if p[0] not in hack:
					urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])
					time.sleep(5)
		time.sleep(20)
	return
FileCheck()
BaseCheck()
HashCheck()

thread.start_new_thread(PyDelete, ())
thread.start_new_thread(ProcCheck, ())

regards

Thank you, nice work :-)

 

 

nice but bypassable :)

 

  • Metin2 Dev 1
Link to comment
Share on other sites

  • Silver

 

 

Hello my own use simple anti cheat protection like enigma;

 

What u need?

  1. Simple php file for logging
  2. Win32modules for 2.2 or 2.7
  3. and badlist.php(
    This is the hidden content, please
    )
  4. and secur.dll(
    This is the hidden content, please
    )
What this Functions:
  1. Base protection > Name + Byte
  2. Folder Secuirty > BGM + Miles + Lib + Main Folder
  3. Folder Check > ".py" + ".mix" + ".m3d" + ".bat" + ".flt" + ".asi"
  4. Hash Check > Miles folder, python core, security base dll, os.pyc(for baseinit methode)
  5. TaskList Check
  6. Windows Check
Script;
import sys
import os
import app
import time
import thread
import dbg
import ui
import md5
import urllib
import uiCommon
from os.path import basename

try:
	import win32api	
except:
	syslog('Cant import win32api module')
	dbg.LogBox("Cant import win32api module")
	app.Exit()

DATA_URL = "http://koray.zz.mu/imtn2/client/"

launchername = sys.executable
taskname = basename(launchername)
launchers = os.path.getsize(taskname)
launchersize = int(launchers)

check=' '.join(os.listdir(os.getcwd()))
check_miles=' '.join(os.listdir(os.getcwd()+"miles"))
check_bgm=' '.join(os.listdir(os.getcwd()+"bgm"))
check_lib=' '.join(os.listdir(os.getcwd()+"lib"))
check_folder=' '.join(os.listdir(os.getcwd()))

######preparation#################################

##HashFonk
def getMd5(file):
	m = md5.new()
	fp = open(file,"rb")
	while 1:
		data = fp.read(1024)
		if not data:break
		m.update(data)
	fp.close()
	return m.hexdigest()
def getMD5ByFileName(file):
	try:
		file = file.strip()
		md5hash = md5.new()
		dllFile = open(file, 'rb')
		tmpFileBlock = dllFile.read()
		dllFile.close()
		md5hash.update(tmpFileBlock)
		md5hash = md5hash.hexdigest()
		return md5hash
	except:
		return ''
def ReturnMd5(file,hash):
	if(getMd5(file) != hash ):return TRUE
	else:return FALSE
def syslog(s):
	file = open('syserr.txt', 'a')
	file.write('n' + s + 'n')
	file.close()
def ingameNotifyPopupAndExit(text = ''):
	popup = uiCommon.PopupDialog()
	popup.SetWidth(700)
	popup.SetText(text)
	popup.Show()
	time.sleep(7)
###/////////######################################

#Base Security > Name+Byte
def BaseCheck():
	global launchername, taskname, launchersize
	
	if not taskname == "metin2cliento.exe" or launchersize == "3171985":
		dbg.LogBox("Wrong launcher")
		os.system("taskkill /im %s /f" % taskname)
		
#Folder Secuirty > BGM + Miles + Lib + Main Folder
def FileCheck():
	global check, check_bgm, check_folder, check_miles, check_lib

	banned_ext=[".mix", ".m3d", ".flt", ".asi", ".bat"]
	miles_clean=["mssa3d.m3d", "mssds3d.m3d", "mssdsp.flt", "mssdx7.m3d", "msseax.m3d", "mssmp3.asi", "mssrsx.m3d", "msssoft.m3d", "mssvoice.asi"]
	lib_clean=['__future__.pyc','copy_reg.pyc','linecache.pyc','ntpath.pyc','os.pyc','site.pyc','stat.pyc','string.pyc','traceback.pyc','types.pyc','UserDict.pyc','urllib.pyc','win32con.pyc','threading.pyc']
	folder_clean=['BGM', 'artpclnt.dll', 'pn.dll', 'channel.inf', 'config.exe', 'devil.dll', 'DSETUP.dll', 'errorlog.exe', 'errorlog.txt', 'granny2.dll', 'ijl15.dll', 'ilu.dll', 'locale.cfg', 'metin2cliento.exe', 'metin2.cfg', 'mouse.cfg', 'mscoree.dll', 'MSS32.DLL', 'msvcp60.dll', 'MSVCRTD.DLL', 'patchw32.dll', 'python22.dll', 'SpeedTreeRT.dll', 'syserr.txt', 'unicows.dll', 'hshield', 'lib', 'mark', 'miles', 'pack', 'temp', 'upload', 'patchskin', 'skins', 'screenshot']
	bgm_clean=['a_rhapsody_of_war.mp3','another_way.mp3','back_to_back.mp3','blacksea.mp3','catacomb_of_devil.mp3','characterselect.mp3','death_of_landmark.mp3','desert.mp3','enter_the_east.mp3','follow_war_god.mp3','last-war2.mp3','login_window.mp3','lost_my_name.mp3','m2bg.mp3','misty_forest.mp3','monkey_temple.mp3','mountain_of_death.mp3','mt.mp3','only_my_battle.mp3','open_the_gate.mp3','save_me.mp3','wedding.mp3','wonderland.mp3','xmas.mp3']

	for i in miles_clean:
		check_miles=check_miles.replace(i, '')
	for i in lib_clean:
		check_lib=check_lib.replace(i, '')
	for i in bgm_clean:
		check_bgm=check_bgm.replace(i, '')
	for i in folder_clean:
		check_folder=check_folder.replace(i, '')
	for i in banned_ext:
		if check.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_bgm.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_miles.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_lib.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
		if check_folder.find(i) != -1:
			f=open("syserr.txt", "w")
			nome="%s%s" % (i[0].upper(), i[1:])
			f.write("[HACKSHIELD]Invaild File!n" + nome)
			f.close()
			app.Exit()
#Folder check > ".py"			
def PyDelete():
	while 1 == 1:
		files = [f for f in os.listdir('.') if os.path.isfile(f)]
		for f in files:
			if f.endswith(".py"):
				f1 = f
				try:
					os.remove(f)
				except:
					pass

				if f1 == "logininfo.py":
					syslog("[HACKSHIELD]Detected Hack File")
					app.Exit("")
		time.sleep(1)
		
#######Hash Control
def HashCheck():
	##Miles
	if len(os.listdir('miles')) != 10 :
		return 'Wrong file detected'
	d = {
		'miles/mss32.dll': '6400e224b8b44ece59a992e6d8233719',
		'miles/mssa3d.m3d':'e089ce52b0617a6530069f22e0bdba2a', 
		'miles/mssds3d.m3d':'85267776d45dbf5475c7d9882f08117c',
		'miles/mssdsp.flt':'cb71b1791009eca618e9b1ad4baa4fa9',
		'miles/mssdx7.m3d':'2727e2671482a55b2f1f16aa88d2780f',
		'miles/msseax.m3d':'788bd950efe89fa5166292bd6729fa62',
		'miles/mssmp3.asi':'189576dfe55af3b70db7e3e2312cd0fd',
		'miles/mssrsx.m3d':'7fae15b559eb91f491a5f75cfa103cd4',
		'miles/msssoft.m3d':'bdc9ad58ade17dbd939522eee447416f',
		'miles/mssvoice.asi':'3d5342edebe722748ace78c930f4d8a5'
		}
	for x in d:
		if ReturnMd5(x, d[x]): return TRUE
		else: return FALSE
				
	if getMd5("python22.dll") != "97FB91610702B63F071282E9CF86B8C0" :
		dbg.LogBox("Invaild file:" + "python22.dll")
		app.Exit()
	if getMd5("secur.dll") != "F01C8F12DD4662F566433B6DA1B2735E" :
		dbg.LogBox("Invaild file:" + "secur.dll")
		app.Exit()
	if getMd5("lib/os.pyc") != "d0d09c7daa9d57373cd7586a74ec4099" :
		dbg.LogBox("Invaild file:" + "os.pyc")
		app.Exit()

##CheckProcess
def ProcCheck():
	whitelist = ["putty.exe","filezilla.exe"]
	hack = []
	result = []
	
	while 1==1:
		for l in os.popen("secur.dll "+ str(os.getpid())).readlines():
			line = l.lower()
			if (line.find("switch") != -1 or line.find("hack") != -1 or line.find("inject") != -1  or line.find("bot") != -1 or 
				line.find("loader") != -1 or line.find("lalaker") != -1 or line.find("hile") != -1):
					urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])
					time.sleep(5)
					break
		for line in os.popen('secur.dll ' + str(os.getpid())).readlines():
			try:
				if line.strip() != '' and line.strip().startswith('EXE'):
					line = line.split(' ')
					line.pop(0)
					line.pop(0)
					line = ' '.join(line)
					f = open(line.strip(), 'r')
					if f:
						result.append(line.strip())
			except:
				continue
		return []
		for p in os.popen("tasklist v"):
			processi = p.read().lower()
			if (processi.find("hack") != -1 or processi.find("inject") != -1 or processi.find("inject") != -1  or 
				processi.find("bot") != -1 or processi.find("cheat") != -1 or processi.find("ollydbg") != -1 or 
				processi.find("actool") != -1 or processi.find("allydbg") != -1 or processi.find("ollyice") != -1 or 
				processi.find("windbg") != -1 or processi.find("softice") != -1 or processi.find("m2bob") != -1):
				p = processi.split()
				if p[0] in whitelist: 
					continue
					time.sleep(4)
				if p[0] not in hack:
					urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])
					time.sleep(5)
		time.sleep(20)
	return
FileCheck()
BaseCheck()
HashCheck()

thread.start_new_thread(PyDelete, ())
thread.start_new_thread(ProcCheck, ())

regards

Thank you, nice work :-)

 

 

nice but bypassable :)

 

 

 

yep this only base protection like enigma, this not completely anti cheat. in addition to you only need to disable readmemory for anti-bypass 

  • Metin2 Dev 1
Link to comment
Share on other sites

  • Silver

Please TuT for install? 

 

Download this script and call with prototype.py, like "import pyname"

 

 

Why you are not trying to make these things in c++? And this is not good anti cheat system.

 

Best Regards

Ellie

 

This is basic anti cheat system, not fully game protection system :)

Link to comment
Share on other sites

  • 10 months later...
  • 10 months later...

wow perfect koray,

urllib.urlopen(DATA_URL + "hack.php?oyuncu=" + player.GetName() + "&server=" + str(net.GetServerInfo().split(',')[0]) + "&hack=" + l[0])

hack.php or sql table please necessary

test_url = urllib.urlopen(url + "/offline_pn.php?mode=add&sender=" + player.GetName() + "&reciever=" + name + "&txt=" + constInfo.chat_string.replace(" ", "%20")).read()

PHP data not sql please help sql?

 

Koray?

  • Good 2
Link to comment
Share on other sites

  • 4 years later...
  • Management

 Dead Download Link 

 Moved Topic 

 

If someone has the archive of this topic, can you send it to us? Thank you!

 

Puss In Boots Please GIF by swerk

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Management
Link to comment
Share on other sites

  • 6 months later...


×
×
  • 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.