using System;
using System.Diagnostics;
using System.Linq;
namespace AOBScan
{
class Program
{
static void Main(string[] args)
{
// Process adı
string processName = "notepad";
// AOB (Array of Bytes)
byte[] signature = new byte[] { 0x48, 0x8B, 0x05, 0x00, 0x00, 0x00, 0x00, 0xC3 };
// İşlemi seç
Process process = Process.GetProcessesByName(processName).FirstOrDefault();
// Eğer işlem bulunamadıysa hata ver
if (process == null)
{
Console.WriteLine("İşlem bulunamadı.");
return;
}
// Bellek alanı tarama
IntPtr address = Scan(process, signature);
// Eğer bellek alanında tarama yapılamadıysa hata ver
if (address == IntPtr.Zero)
{
Console.WriteLine("AOB bulunamadı.");
return;
}
Console.WriteLine("AOB bulundu: 0x" + address.ToString("X"));
}
private static IntPtr Scan(Process process, byte[] signature)
{
// Bellek alanı okuma izni
IntPtr baseAddress = process.MainModule.BaseAddress;
int size = process.MainModule.ModuleMemorySize;
// Bellek alanını byte dizisine ata
byte[] buffer = new byte[size];
IntPtr readBytes = IntPtr.Zero;
WinApi.ReadProcessMemory(process.Handle, baseAddress, buffer, size, out readBytes);
// Bellek alanındaki byte dizisini tarama
for (int i = 0; i < size - signature.Length; i++)
{
bool found = true;
for (int j = 0; j < signature.Length; j++)
{
if (buffer[i + j] != signature[j])
{
found = false;
break;
}
}
if (found)
{
return baseAddress + i;
}
}
return IntPtr.Zero;
}
}
internal static class WinApi
{
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [System.Runtime.InteropServices.In, System.Runtime.InteropServices.Out] byte[] buffer, int size, out IntPtr lpNumberOfBytesRead);
}
}