[SorpzFramework.Diagnostics] ProcessAccessor

Posts 1–6 of 6 · Page 1 of 1
[SorpzFramework.Diagnostics] ProcessAccessor
ProcessAccessor
by sorpz


Hey community,
today I want to bring you my finally finished and almost stable project "ProcessAccessor". The Idea behind this project is to simplefy all the complex stuff you'll have to do creating hacks, mods or whatever like importing api functions. This isn't needed anymore. Just use this easy type structures to get along with it. So let's start with the main features of it...
As usual for a accessor you could read and write memory to your target process. On the one hand you could use the known methods like 'ReadMemoryInteger(), ReadMemoryDouble(), etc' on the other I'm giving you the ability to use something called typeparameters which will be used like ' ReadMemory<T>()' or 'WriteMemory<T>()'. The parameter 'T' is limited to struct types only better known as value or non-nullable types. Therefore there aren't the possibiliy to use them with 'string' or array types. But the class is including other methods to handle those types..
In addition to the read and write features there are also functions to freeze and break the memory handled. I think you know what "freezing" memory means so let me explain the "breaking". By "breaking" memory you'll simply set breakpoints. If the memoryaddress the breakpoint is located at changes its value the "ProcessAccessor" will raise an event holding data like 'LastValue' and 'CurrentValue'. Enough explaining stuff. I'll get you some example code now...
(for more information about the features & methods, etc check the class diagramm attached...)


 
Samplecode # 1 (Basics)

Code:
using System;
// required for 'ProcessAccressor'
// also includes extensions...
using SorpzFramework.Diagnostics;


namespace Custom {
    class Program {
        static void Main(string[] args) {
            // getting the target process (worst way to do it, but simplest for samplecode)
            Process target = Process.GetProcessesByName("hl2")[0];
            // creating 'ProcessAccessor' to modify target process
            using (var accessor = new ProcessAccessor(target)) {
                IntPtr clientModule;
                // getting base of 'client.dll' module
                if (accessor.IsModuleReady("client.dll"))
                    clientModule = accessor.GetModuleBaseAddress("client.dll");
                // activating  'r_drawothermodels'...
                accessor.WriteMemory<int>(clientModule + 0x53C270, 2);
            }
            return;
        }
    }
}

(code converted using BBThreadPostHighlighter type - http://www.mpgh.net/forum/160-progra...sts-sorpz.html)

 
Samplecode # 2 (Extensions)

Code:
using System;
// required for 'ProcessAccressor'
// also includes extensions...
using SorpzFramework.Diagnostics;


namespace Custom {
    class Program {
        static void Main(string[] args) {
            // getting the target process (worst way to do it, but simplest for samplecode)
            Process target = Process.GetProcessesByName("hl2")[0];
            IntPtr clientModule;
            if (target.IsModuleReady("client.dll"))
                clientModule = target.BaseOf("client.dll");
            // sets the value of 'r_drawothermodels' to 2 for simple wire wallhack
            target.WriteMem<int>(clientModule + 0x53C270, 2);
            return;
        }
    }
}

(code converted using BBThreadPostHighlighter type - http://www.mpgh.net/forum/160-progra...sts-sorpz.html)

 
Samplecode # 3 (Breakpoints)

Code:
using System;
// required for 'ProcessAccressor'
// also includes extensions...
using SorpzFramework.Diagnostics;


namespace Custom {
    class Program {
        static ProcessAccessor someAccessor;
        static void Main(string[] args) {
            // getting the target process (worst way to do it, but simplest for samplecode)
            Process target = Process.GetProcessesByName("hl2")[0];
            IntPtr clientModule;
            if (target.IsModuleReady("client.dll"))
                clientModule = target.BaseOf("client.dll");
            // setting up accessor
            someAccessor = new ProcessAccessor(target);
            // binding event
            someAccessor.BreakpointAccessed += new EventHandler<ProcessBreakEventArgs>(BreakpointAccessed);
            // setting breakpoint
            someAccessor.SetBreakpoint(target.ReadMem<int>(clientModule + 0x53FB04) + 0x90, sizeof(int));
            return;
        }


        static void BreakpointAccessed(object sender, ProcessBreakEventArgs e) {
            // shows the health as soon as it changes
            Console.WriteLine(string.Format("Health changed from {0} to {1}..", e.LastValue, e.CurrentValue));
        }
    }
}

(code converted using BBThreadPostHighlighter type - http://www.mpgh.net/forum/160-progra...sts-sorpz.html)


Note: For specified information about something included in the 'ProcessAccessor' type see the documentation appearing while coding..



Virusscans

Virustotal: https://www.virustotal.com/en/file/6...is/1376616537/
Jotti:
http://virusscan.jotti.org/de/scanre...d7e88801501597




Credits

Sorpz (me) - SorpzFramework...


SorpzFramework.Diagnostics_mpgh.net.rar8 KB · 27 downloads Clean
Hello, firstly, i want to thank you for your hard work and i want to say, that it's very very useful, thank you!
My question is: what the hell is wrong with my reference? I haven't had such a stupid problem before. please, help
Quote Originally Posted by aquanaft View Post
Hello, firstly, i want to thank you for your hard work and i want to say, that it's very very useful, thank you!
Thank you I'm happy to see someone who's trying

Quote Originally Posted by aquanaft View Post
My question is: what the hell is wrong with my reference? I haven't had such a stupid problem before. please, help.
Easy one.. you'll have to instantly initialize the 'IntPtr clientModule'.. It's my fault. I'm giving a wrong up in my main thread. Thanks for checking..
You'll have to change from ..
Code:
// not initialized..
IntPtr clientModule; 
to this ..
Code:
// this will be the right one..
IntPtr clientModule = IntPtr.Zero; 
Hope it helped..
Thanks for solving another problem , but i asked about
Code:
using SorpzFramework.Diagnostics;
- it doesn't see this reference, as you can see on my screenshot in previous message. Thank you. If you have skype, please add me "antoshka741" w/o the quotes
Ouh fu**. Also my fault.. I forgot to rename the namespace from 'System.Diagnostics' to 'SorpzFramework.Diagnostics' :S ... Will change this and reupload it..
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

Talk with us