C# Better Trainer Class

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
Here is my trainer class, which I downloaded but then added some features and now I want to share with you:

Features:

- Read Int8, Int16, Int32, Int64, float, double, string
- Write Int8, Int16, Int32, Int64, float, double, string

- Read Pointer Int8, Int16, Int32, Int64, float, double
- Write Pointer Int8, Int16, Int32, Int64, float, double

- Write Code Injection
- Write Byte Array (nice for opcodes)
- Write String
- Write NOPs

- Check Game availabilty (by window title)
- Suspend and Resume Processes


Int8=byte, with string, ASCII is meant, not Unicode.

Credits ofc also to "Cless" of the CheatEngine forum
(->Cheat Engine :: View topic - Easy C# & VB.NET Trainer class)


I thought that somebody of you would maybe need it. I also made a DLL which you can use.

Let me know whether it worked and it useful or not:D


MemoryHacking.dll Virus Scan
https://virusscan.jotti.org/de/scanresult/c2fc7949fb9bd0f4033b84ba832ef2d4b9852ed3
 

Attachments

Last edited by a moderator:

Syperus

RTFM
Meme Tier VIP
Dank Tier Donator
Oct 29, 2012
432
2,638
7
Nice share! And thank you for properly crediting the author.
 

hacke21

Newbie
Full Member
Jun 3, 2013
7
172
0
Check ReadPointerInt16 in MemoryHacking.cs !

C++:
if (Handle != 0)
                    {
                        foreach (int i in Offset)
                        {
                            ReadProcessMemoryInteger((int)Handle, Pointer, ref Pointer, 2, ref Bytes);
                            Pointer += i;
                        }
                        ReadInt16(EXENAME, Pointer);
                        //ReadProcessMemoryInteger((int)Handle, Pointer, ref Value, 4, ref Bytes);
                        CloseHandle(Handle);
should be

C++:
 Value = ReadInt16(EXENAME, Pointer);
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
Check ReadPointerInt16 in MemoryHacking.cs !

C++:
if (Handle != 0)
                    {
                        foreach (int i in Offset)
                        {
                            ReadProcessMemoryInteger((int)Handle, Pointer, ref Pointer, 2, ref Bytes);
                            Pointer += i;
                        }
                        ReadInt16(EXENAME, Pointer);
                        //ReadProcessMemoryInteger((int)Handle, Pointer, ref Value, 4, ref Bytes);
                        CloseHandle(Handle);
should be

C++:
 Value = ReadInt16(EXENAME, Pointer);
Correct sir. Thanks for reporting this, I will fix it :)
 

vmv

Newbie
Full Member
May 26, 2013
14
188
0
Hi,
till0sch97, ...can you make this function smaller then this or combine them :)...?

C#:
private void OpenProcess()
{
    Process[] procs = Process.GetProcessesByName("game.exe");
    if (procs.Length == 0)
    {
        MessageBox.Show("start the game first...!");
        return;
    }
    else
    {
        int dwPid = procs[0].Id; hProcess = OpenProcess(0x1F0FFF, false, dwPid);

        ProcessModuleCollection modules = procs[0].Modules; foreach (ProcessModule module in modules)
        {
            if (module.ModuleName == "game.dll")
            {
                gameBase = module.BaseAddress.ToInt32() + 0x00000000;
            }
        }
    }
}
private int read(int address, int[] offset)
{
    int value = 0; int bytes = 0;
    Process[] procs = Process.GetProcessesByName("game.exe");
    if (procs.Length != 0)
    {
       IntPtr  hProcess = OpenProcess(0x1F0FFF, false, dwPid);
        foreach (int i in offset)
        {
            ReadPointers(hProcess, address, ref address, 4, ref bytes);
            address += i;
        }
        ReadPointers(hProcess, address, ref value, 4, ref bytes);
    }
    return value;
}
//calling
int final = read(gameBase, new int[] { 0x10, 0x20, 0x30, 0x40, 0x50 });

//api
[DllImport("kernel32", EntryPoint = "ReadProcessMemory")]
private static extern int ReadPointers(IntPtr hProcess, int Address, ref int Value, int nSize, ref int BytesRead);
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(uint dwDesiredAccess, bool InheritHandle, int dwProcessId);
Is nothing important ..just if you have time..

Thank you,
 

vmv

Newbie
Full Member
May 26, 2013
14
188
0
C++:
private int OpenProcess(int address, int[] offset)
{
    Process[] procs = Process.GetProcessesByName("game.exe");
    if (procs.Length == 0)
    {
        MessageBox.Show("start the game first...!");
        return 1;
    }
    else
    {
        dwPid = procs[0].Id; hProcess = OpenProcess(0x1F0FFF, false, dwPid);
        ProcessModuleCollection modules = procs[0].Modules; foreach (ProcessModule module in modules)
        {
            if (module.ModuleName == "game.dll")
            {
                gameBase = module.BaseAddress.ToInt32() + 0x00000000;
            }
        }
        foreach (int i in offset)
        {
            ReadPointers(hProcess, address, ref address, 4, ref bytes);
            address += i;
        }
        ReadPointers(hProcess, address, ref value, 4, ref bytes);
        return value;
    }
}
Can be done more compact then this ?
Anyone... :) ?
This could be a good function to do more things for every newbie like me.. : open proc,get module base address, read pointers from that base address...etc etc.
Thank you,
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
Why more compact, doesn't this work? What you basically do is getting a handle from a process name and calling ReadProcessMemory (and later on closing the handle).
 

vmv

Newbie
Full Member
May 26, 2013
14
188
0
Why more compact...because it's possible..
What i need is : open process, get remote modudle base address, read pointers from that module..
If you write that in a normal way...you will need alot of code...but as you can see, can be done in a shorter way :)
I'm not that good at C#...i'm just understanding it a bit.
So, can be done even smaller then this ?
It is working fine like this btw,.

Thank you,
 

vmv

Newbie
Full Member
May 26, 2013
14
188
0
In your library...
You call : "private const int PROCESS_ALL_ACCESS = 0x1F0FFF;" when you can simply use "0x1F0FFF".
You use : "Process[] Proc = Process.GetProcessesByName(EXENAME);" and then call it..when you can use simply : "Process[] Proc = Process.GetProcessesByName(game.exe);"
I think you can remove this also : "if (Handle != 0)..."
There are more...
My idea is actually if you can make a smaller library without so many codes just to open smth...

I think you can do it :)
Thank you ,
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
In your library...
You call : "private const int PROCESS_ALL_ACCESS = 0x1F0FFF;" when you can simply use "0x1F0FFF".
You use : "Process[] Proc = Process.GetProcessesByName(EXENAME);" and then call it..when you can use simply : "Process[] Proc = Process.GetProcessesByName(game.exe);"
I think you can remove this also : "if (Handle != 0)..."
There are more...
My idea is actually if you can make a smaller library without so many codes just to open smth...

I think you can do it :)
Thank you ,
I don't understand the reason and therefor I won't do it. Do it yourself if you want.
 

vmv

Newbie
Full Member
May 26, 2013
14
188
0
I did..thanks, shorter and better code only in 3-4 lines.
Thx,
 

apt42541

Newbie
Apr 26, 2014
1
104
0
Here is my trainer class, which I downloaded but then added some features and now I want to share with you:

Features:

- Read Int8, Int16, Int32, Int64, float, double, string
- Write Int8, Int16, Int32, Int64, float, double, string

- Read Pointer Int8, Int16, Int32, Int64, float, double
- Write Pointer Int8, Int16, Int32, Int64, float, double

- Write Code Injection
- Write Byte Array (nice for opcodes)
- Write String
- Write NOPs

- Check Game availabilty (by window title)
- Suspend and Resume Processes


Int8=byte, with string, ASCII is meant, not Unicode.

Credits ofc also to "Cless" of the CheatEngine forum
(->https://forum.cheatengine.org/viewtopic.php?p=5347687&sid=6cff803aa31fb8676a66e1ee329fb191)


I thought that somebody of you would maybe need it. I also made a DLL which you can use.

Let me know whether it worked and it useful or not:D


MemoryHacking.cs:
https://guidedhacking.com/attachment.php?attachmentid=1719&stc=1&d=1364413551

MemoryHacking.dll:
https://guidedhacking.com/attachment.php?attachmentid=1721&stc=1&d=1364413750

MemoryHacking.dll Virus Scan
https://virusscan.jotti.org/de/scanresult/c2fc7949fb9bd0f4033b84ba832ef2d4b9852ed3
and then readpointerstring do you have ?
 

Scarletblanks

Newbie
Full Member
Nobleman
Nov 25, 2015
62
763
1
Looks like I am years late to this thread but... well... hope you're doing well OP.

Does anyone have an example of them using this that I can read off?
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods