Hello, I'm looking for a solution to close the client when cheat engine is open? I know that isn't the best solution to stop cheating but I already have alot of checks in place to stop interface interacting if its not open via server. Anyway to keep this post short. I just need a way to close the client once it detects cheat engine is open... I have some code to share that I've tried using but with no luck...
Code:
public static void checkForCheats() throws IOException, InterruptedException{
System.out.println("Checking for cheats!");
String findProcess = "Cheat Engine.exe";
String filenameFilter = "/nh /fi \"Imagename eq "+findProcess+"\"";
String tasksCmd = System.getenv("windir") +"/system32/tasklist.exe "+filenameFilter;
Process p = Runtime.getRuntime().exec(tasksCmd);
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
ArrayList<String> procs = new ArrayList<String>();
String line = null;
while ((line = input.readLine()) != null)
procs.add(line);
input.close();
Boolean processFound = procs.stream().filter(row -> row.indexOf(findProcess) > -1).count() > 0;
// Head-up! If no processes were found - we still get:
// "INFO: No tasks are running which match the specified criteria."
if(processFound) {
JOptionPane.showMessageDialog(null, Configuration.CLIENT_NAME+" has detected Third party Software! "+Configuration.CLIENT_NAME+" will now close!", Configuration.CLIENT_NAME+" Cheat Protection", JOptionPane.ERROR_MESSAGE);
}
}
This code is called under the doAction Method in client.java (I know I don't actually close the client with this code but it doesn't even send the pop up dialogue so it's not detecting cheat engine even when it's open...)