Cheat Engine Detection?
Hello
Im here trying to protect my game from cheats!
As we all know the worlds most used memory editing software is cheat engine
So what i want to know is do we have the ability to detect cheat engine? I guess we have to select the app in the cheat engine for editing
Is there anyway we can detect cheat engine , If the user tries to scan a value , the app detects it and does a Application.Quit()
I tried anticheat toolkit by codestage but it protects only speed hacks(or maybe i dont know) , i kind of want more explanation on this
Answer by ElementalVenom · Aug 09, 2016 at 07:31 PM
The best way that I have done it is by doing simple checks on your variables.
For instance lets say you have a health variable. You have it between 0-100. One simple check you can do is if its over 100 then they've messed with it.
Another way would be to make 2 variables one called health one called tmpHealth and make tmpHealth always 20 points higher than normal health. Then always make sure health is 20 less than tmpHealth. And if not they've messed with it. Simple checks like that can do what you want.
EDIT: You can also just detect if cheat engine is running on the computer using this:
foreach (Process pro in Process.GetProcesses())
{
if (pro.ProcessName.ToLower().Contains("cheat") && pro.ProcessName.ToLower().Contains("engine"))
{
//Cheat engine is running!
}
}
Then you can either do Application.Quit() or do pro.Kill() to force close cheat engine. You should do this a few times while the program is running to make sure they dont start it after they start your game.
I think its good to note though that if its a singleplayer game it doesnt really matter if they hack it because its only effecting them. If its multiplayer then there is much more you can do to prevent this some of the methods even involve streaming your entire DLL to the server for validation.(Which only takes 1-2 seconds)
EDIT2:
Getting the hash of a DLL is simple. Then its just a matter of sending it to the server and having the server get the hash as well. Then the server verifies if the hashes match. You're going to want to hash the 'Assembly-CSharp.dll' file that Unity3D makes for every game(Found in _Data/Managed/Assembly-CSharp.dll)
You can get the files hash with this code:
static string GetHash(string FilePath)
{
FileStream fStream = null;
try
{
fStream = new FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
}
catch (Exception ex)
{
Console.WriteLine("ERROR:" + ex.Message);
Console.ReadLine();
}
byte[] myArray = new byte[fStream.Length];
fStream.Read(myArray, 0, myArray.Length);
fStream.Close();
fStream.Dispose();
string hash;
using (SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider())
{
return Convert.ToBase64String(sha1.ComputeHash(myArray));
}
}
BUT BE WARNED! They can modify the code client-side to send the server a false hash! Dont use this as your only authentication!
Thanks a lot
BTW i didnt get the part where you say 'Strea$$anonymous$$g your entire DLL to the server'
Can i get more explanation on this? :p
Just edited the main answer. If this was actually helpfull please accept it as the answer :3
Also I ment hashing it not strea$$anonymous$$g it. This is the fastest method and sending the entire DLL wouldnt help at all.
Thanks a lot I got the cheat engine detection working :) And i understood what you said about the dll Great help Thanks!
Another thing to note is that this will only prevent modification of the actual files. If they change the variables with cheat engine the hash wont change(Because they arnt modifying the actual files)
Check for all the things above b4 saving any data client side or b4 sending to server
Answer by Sam-DreamsMaker · Jul 20, 2018 at 02:21 PM
Hi, Process.GetProcesses() give only processes of the current user, Cheat Engine can be started by the admin user.
To be sure I suggest you to use a script on a GameObject like that :
using System; using UnityEngine; using UnityEngine.UI;
public class CheckFlowOfTime : MonoBehaviour {
//attributes to see changes during tests
[SerializeField]
private Text time;
[SerializeField]
private Text systemeTime;
[SerializeField]
private Text updatedText;
[SerializeField]
private Text lifeText;
[SerializeField]
private Text toleranceText;
[SerializeField]
private int life = 3;
[SerializeField]
private int gapTolerance = 3;
private DateTime startDateTime = System.DateTime.Now;
private DateTime updatedDateTime = System.DateTime.Now;
public void Start() {
InvokeRepeating(nameof(checkTime),0,1);
}
//not optimized, remove it when you will finish tests
private void Update() {
time.text = "time " + Time.time.ToString();
systemeTime.text = "systemTime " + System.DateTime.Now.ToString();
updatedText.text = "updateTime " + updatedDateTime.ToString();
lifeText.text = "life " + life.ToString();
toleranceText.text = "tolerance " + gapTolerance.ToString()+" s";
}
private void checkTime() {
updatedDateTime = updatedDateTime.AddSeconds(1);
if (updatedDateTime > System.DateTime.Now.AddSeconds(gapTolerance)) {
updateLife();
}
}
private void updateLife() {
life--;
if (life == 0) Application.Quit();
TimeSpan timeSpan = updatedDateTime - System.DateTime.Now;
double realGap = timeSpan.TotalSeconds;
gapTolerance += Convert.ToInt32(realGap);
}
}
Your answer
Follow this Question
Related Questions
Any way to add a layer of protection for asset from getting rip from apk 0 Answers
Need urgent help integrating a Unity 5 + Vuforia 6 project into a native iOS App 1 Answer
URP , shader error,,,implicit truncation of vector type error! 2 Answers
I want to use Berkeley DB In Unity3D, What should i do? please give a detailed steps. 0 Answers
ProBuilder: texture UVs mess up badly 0 Answers