JamesMenetrey / MemorySharp

A C# based memory editing library targeting Windows applications, offering various functions to extract and inject data and codes into remote processes to allow interoperability.
Other
634 stars 135 forks source link

Added pattern scanning, improved misc. stuff #6

Closed lolp1 closed 4 years ago

lolp1 commented 8 years ago

-Pattern scanning added (tested)

-x64 support improved via project settings/peb/misc small changes

-Better events in MemorySharp.cs (process data/error output handlers, process exit handlers, standard protected event raise methods)

Here is full working example to test patterns (x64 live WoW legion EnumVisibleObjects function pointer pattern)


using System;
using System.Linq;

namespace TestApp
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var process = System.Diagnostics.Process.GetProcessesByName("Wow-64").FirstOrDefault();

            var memorySharp = new Binarysharp.MemoryManagement.MemorySharp(process);

            var patternScanner = memorySharp.Modules.MainModule.GetPatternScanner();

            var scanResult =
                patternScanner.Find(
                    new Binarysharp.MemoryManagement.Patterns.DwordPattern(
                      "48 89 74 24 ?? 57 48 83 EC 20 48 8B 05 ?? ?? ?? ?? 48 8B F1 48 8B FA 48 8B 88 ?? ?? ?? ?? F6 C1 01 75 05 48 85 C9 75 02"));

            if (!scanResult.ScanWasSuccessful)
            {
                Console.WriteLine("Could not find pattern.");
            }

            Console.WriteLine(scanResult.Offset.ToString("X"));
            Console.WriteLine(scanResult.BaseAddress.ToString("X"));
            Console.WriteLine(scanResult.RebasedAddress.ToString("X"));

            Console.ReadLine();
        }
    }
}
JamesMenetrey commented 8 years ago

64-bit support.

lolp1 commented 8 years ago

I should mention that this is built on the newest .NET framework version...

Zaczero commented 8 years ago

Finally pattern scan function 👍

lolp1 commented 8 years ago

Any updates on any new progress ^^?

JamesMenetrey commented 8 years ago

I'll focus on 64-bit first :D

lolp1 commented 4 years ago

@ZenLulz Can you just close this request and keep it as a reference? The idea is a good start but is not really a good fit with your deepening branch.