Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Growtopia has some sort of anti-cheat

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
vitalityedge42
How do I cheat?
Reputation: 0

Joined: 06 Aug 2021
Posts: 8

PostPosted: Tue Aug 10, 2021 1:58 pm    Post subject: Growtopia has some sort of anti-cheat Reply with quote

I have tried 3 different methods (shown below) to read/write data to a memory from a game called "Growtopia" and apparently, they all fail to attach to the handle of its process. Cheat engine has no problem attaching processes to it and I am even able to modify addresses so I think there could be a solution to this.

Method 1: Using ReadWriteMemory (Python)

Code:
Code:
from ReadWriteMemory import ReadWriteMemory

rwm = ReadWriteMemory()

process = rwm.get_process_by_name("Growtopia.exe")


Output:
Code:
Traceback (most recent call last):
  File "C:\Users\Vincent\PycharmProjects\GrowtopiaWorldExtractor\main.py", line 5, in <module>
    process = rwm.get_process_by_name("Growtopia.exe")
  File "C:\Users\Vincent\AppData\Local\Programs\Python\Python39\lib\site-packages\ReadWriteMemory\__init__.py", line 172, in get_process_by_name
    raise ReadWriteMemoryError(f'Process "{self.process.name}" not found!')
ReadWriteMemory.ReadWriteMemoryError: Process "" not found!


Method 2: Using PyMem (Python)

Code:
Code:
import pymem

pm = pymem.Pymem('Growtopia.exe')


Output:
Code:
Traceback (most recent call last):
  File "C:\Users\Vincent\PycharmProjects\GrowtopiaWorldExtractor\main.py", line 3, in <module>
    pm = pymem.Pymem('Growtopia.exe')
  File "C:\Users\Vincent\AppData\Local\Programs\Python\Python39\lib\site-packages\pymem\__init__.py", line 44, in __init__
    self.open_process_from_name(process_name)
  File "C:\Users\Vincent\AppData\Local\Programs\Python\Python39\lib\site-packages\pymem\__init__.py", line 204, in open_process_from_name
    self.open_process_from_id(self.process_id)
  File "C:\Users\Vincent\AppData\Local\Programs\Python\Python39\lib\site-packages\pymem\__init__.py", line 226, in open_process_from_id
    raise pymem.exception.CouldNotOpenProcess(self.process_id)
pymem.exception.CouldNotOpenProcess: Could not open process: 16704

Process finished with exit code 1



Method 3: Using the Windows API (C++)

Code:
Code:
#include <iostream>
#include <windows.h>
#include <TlHelp32.h>
using namespace std;


HANDLE hProc = NULL;
DWORD pID;


bool attachProc(char* procName)
{
    PROCESSENTRY32 procEntry32;

    procEntry32.dwSize = sizeof(PROCESSENTRY32);

    auto hProcSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);

    if (hProcSnap == INVALID_HANDLE_VALUE)
    {
        std::cout << "Failed to take snapshot of processes!" << std::endl;
        return false;
    }

    while (Process32Next(hProcSnap, &procEntry32))
    {
        std::cout << procEntry32.szExeFile << std::endl;

        if (!strcmp(procName, (char*)procEntry32.szExeFile))
        {
            std::cout << "Found process " << procEntry32.szExeFile << "with process ID of " << procEntry32.th32ProcessID << std::endl;
           
            hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procEntry32.th32ProcessID);
            pID = procEntry32.th32ProcessID;

            if (hProc == NULL)
            {
                std::cout << "Failed getting handle to process." << std::endl;
            }

            CloseHandle(hProcSnap);
            return true;
        }
    }
    std::cout << "Couldn't find " << procName << " in the process snapshot" << std::endl;
    CloseHandle(hProc);
    return false;
}

int main()
{
    attachProc((char*)"Growtopia.exe");

    return EXIT_SUCCESS;
}


Output:
Code:
Found process Growtopia.exe with process ID of 16704
Failed getting handle to process.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25287
Location: The netherlands

PostPosted: Tue Aug 10, 2021 2:16 pm    Post subject: Reply with quote

are you running as admin ?
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
vitalityedge42
How do I cheat?
Reputation: 0

Joined: 06 Aug 2021
Posts: 8

PostPosted: Tue Aug 10, 2021 4:52 pm    Post subject: Reply with quote

Dark Byte wrote:
are you running as admin ?

Neither running it as admin does not work, unfortunately. It works fine without a single problem with other program such as AssaultCube untill I try it with Growtopia.
Back to top
View user's profile Send private message
DanyDollaro
Master Cheater
Reputation: 3

Joined: 01 Aug 2019
Posts: 334

PostPosted: Tue Aug 10, 2021 6:05 pm    Post subject: Reply with quote

Try calling GetLastError after calling OpenProcess, just add this line:
Code:
std::cout << "[" << GetLastError() << "]"<< std::endl;

after this one:
Code:
hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procEntry32.th32ProcessID);

(And show us the output)
Back to top
View user's profile Send private message
vitalityedge42
How do I cheat?
Reputation: 0

Joined: 06 Aug 2021
Posts: 8

PostPosted: Tue Aug 10, 2021 6:26 pm    Post subject: Reply with quote

DanyDollaro wrote:
Try calling GetLastError after calling OpenProcess, just add this line:
Code:
std::cout << "[" << GetLastError() << "]"<< std::endl;

after this one:
Code:
hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procEntry32.th32ProcessID);

(And show us the output)


"[5]" shows up

Code:
Found process Growtopia.exewith process ID of 12768
[5]
Failed getting handle to process.
Back to top
View user's profile Send private message
DanyDollaro
Master Cheater
Reputation: 3

Joined: 01 Aug 2019
Posts: 334

PostPosted: Tue Aug 10, 2021 8:21 pm    Post subject: Reply with quote

vitalityedge42 wrote:
"[5]" shows up

That's weird, 5 stand for ERROR_ACCESS_DENIED [https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-], If you are running it as administrator it means that there is actually something that prevents you from opening that process in particular, but I don't know the game so I don't know what to tell you.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25287
Location: The netherlands

PostPosted: Wed Aug 11, 2021 4:45 am    Post subject: Reply with quote

try obtaining SeDebugPrivilege before calling OpenProcess
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
vitalityedge42
How do I cheat?
Reputation: 0

Joined: 06 Aug 2021
Posts: 8

PostPosted: Wed Aug 11, 2021 8:23 am    Post subject: Reply with quote

Dark Byte wrote:
try obtaining SeDebugPrivilege before calling OpenProcess


Thank you so much, giving it debug privilege and running it as admin fixed the problem! Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites