public void Update(Process proc, int ClientBase, int ClientSize, int EngineBase, int EngineSize) { ProcessMemory Mem = new ProcessMemory(proc.Id); Mem.StartProcess(); SigScan ClientScan = new SigScan(proc, new IntPtr(ClientBase), ClientSize); SigScan EngineScan = new SigScan(proc, new IntPtr(EngineBase), EngineSize); IntPtr ptr = ClientScan.FindPattern(new byte[] { 0x05, 0x00, 0x00, 0x00, 0x00, 0xC1, 0xE9, 0x00, 0x39, 0x48, 0x04 }, "x????xx?xxx", 0); int p1 = Mem.ReadInt((int)ptr + 1); byte p2 = Mem.ReadByte((int)ptr + 7); m_dwEntityList = (p1 + p2) - ClientBase; ptr = ClientScan.FindPattern(new byte[] { 0x8D, 0x34, 0x85, 0x00, 0x00, 0x00, 0x00, 0x89, 0x15, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x41, 0x08, 0x8B, 0x48, 0x00 }, "xxx????xx????xxxxx?", 0); p1 = Mem.ReadInt((int)ptr + 3); p2 = Mem.ReadByte((int)ptr + 18); m_dwLocalPlayer = (p1 + p2) - ClientBase; ptr = ClientScan.FindPattern(new byte[] { 0xF3, 0x0F, 0x6F, 0x05, 0x00, 0x00, 0x00, 0x00, 0x8D, 0x85 }, "xxxx????xx", 0); p1 = Mem.ReadInt((int)ptr + 4) + 0xB0; m_dwViewMatrix = p1 - ClientBase; ptr = ClientScan.FindPattern(new byte[] { 0xA1, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x01, 0x75, 0x00, 0x0F, 0x57, 0xC0, 0xC7, 0x05 }, "x????xxx?xxxxx", 0); m_dwGlowObject = Mem.ReadInt((int)ptr + 0x58) - ClientBase; ptr = ClientScan.FindPattern(new byte[] { 0x89, 0x15, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x15, 0x00, 0x00, 0x00, 0x00, 0xF6, 0xC2, 0x03, 0x74, 0x03, 0x83, 0xCE, 0x08, 0xA8, 0x08, 0xBF }, "xx????xx????xxxxxxxxxxx", 0); m_dwForceJump = Mem.ReadInt((int)ptr + 2) - ClientBase; ptr = ClientScan.FindPattern(new byte[] { 0x89, 0x15, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x15, 0x00, 0x00, 0x00, 0x00, 0xF6, 0xC2, 0x03, 0x74, 0x03, 0x83, 0xCE, 0x04, 0xA8, 0x04, 0xBF }, "xx????xx????xxxxxxxxxxx", 0); m_dwForceAttack = Mem.ReadInt((int)ptr + 2) - ClientBase; ptr = ClientScan.FindPattern(new byte[] { 0xF3, 0x0F, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0xEB, 0x0F, 0x8B, 0x01, 0x8B, 0x40, 0x30, 0xFF, 0xD0, 0xD9, 0x5D, 0x0C, 0xF3, 0x0F, 0x10, 0x45, 0x0C, 0xF3, 0x0F, 0x11 }, "xxxx????xxxxxxxxxxxxxxxxxxxx", 0); m_dwSensitivity = Mem.ReadInt((int)ptr + 4) - ClientBase; m_dwMouseEnable = m_dwSensitivity + 0x5C; ptr = ClientScan.FindPattern(new byte[] { 0x56, 0x57, 0x8B, 0xF9, 0xC7, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x81, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x75, 0x07, 0xA1, 0x00, 0x00, 0x00, 0x00, 0xEB, 0x07 }, "xxxxxx????????xx????xx????xxx????xx", 0); m_iCrossHairID = Mem.ReadInt((int)ptr + 6); ptr = EngineScan.FindPattern(new byte[] { 0xF3, 0x0F, 0x5C, 0xC1, 0xF3, 0x0F, 0x10, 0x15, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x2F, 0xD0, 0x76, 0x04, 0xF3, 0x0F, 0x58, 0xC1, 0xA1, 0x00, 0x00, 0x00, 0x00, 0xF3, 0x0F, 0x11, 0x80, 0x00, 0x00, 0x00, 0x00, 0xD9, 0x46, 0x04 }, "xxxxxxxx????xxxxxxxxxx????xxxx????xxx", 0); m_dwClientState = Mem.ReadInt((int)ptr + 22) - EngineBase; m_dwViewAngles = Mem.ReadInt((int)ptr + 30); ptr = ClientScan.FindPattern(new byte[] { 0xA1, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x0C, 0xB0, 0x8B, 0x01, 0xFF, 0x50, 0x00, 0x46, 0x3B, 0x35, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xEA, 0x8B, 0x0D, 0x00, 0x00, 0x00, 0x00 }, "x????xxxxxxx?xxx????xxxx????", 0); m_dwRadarBase = Mem.ReadInt((int)ptr + 1) - ClientBase; ptr = ClientScan.FindPattern(new byte[] { 0xF3, 0x0F, 0x10, 0x96, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x57, 0xDB, 0x0F, 0x2F, 0xD3, 0x0F, 0x86, 0x00, 0x00, 0x00, 0x00 }, "xxxx????xxxxxxxx????", 0); m_iGlowIndex = Mem.ReadInt((int)ptr + 4) + 0x18; }
public IntPtr AoBScan(uint min, int length, string code, string file = "") { string[] stringByteArray = LoadCode(code, file).Split(' '); byte[] myPattern = new byte[stringByteArray.Length]; string mask = ""; int i = 0; foreach (string ba in stringByteArray) { if (ba == "??") { myPattern[i] = 0xFF; mask += "?"; } else { myPattern[i] = Byte.Parse(ba, NumberStyles.HexNumber); mask += "x"; } i++; } SigScan _sigScan = new SigScan(procs, new UIntPtr(min), length); IntPtr pAddr = _sigScan.FindPattern(myPattern, mask, 0); return(pAddr); }
public static int ScanPattern(string mModuleName, string mPattern, int Offset = 0, int Extra = 0, bool ModuleSubract = false) { IntPtr hProcess = m_iProcess.Handle; ProcessModule SelectedModule = null; foreach (ProcessModule module in m_iProcess.Modules) { if (Path.GetFileName(module.FileName) == mModuleName) { SelectedModule = module; } } if (SelectedModule == null) { throw new Exception("Selected Module is Null !"); } var scanner = new SigScan(hProcess); scanner.SelectModule(SelectedModule.BaseAddress, SelectedModule.ModuleMemorySize); int Scaned = (int)scanner.FindPattern(mPattern, out long time); if (Scaned != 0) { var Scan = BitConverter.ToInt32(Read(Scaned + Offset, 4), 0) + Extra; if (ModuleSubract) { Scan -= (Int32)SelectedModule.BaseAddress; } return(Scan); } else { return(0); } }
public void Initialize(bool usePatternScan = false) { Memory = new RemoteMemory(Process.GetProcessesByName("ConanSandbox")[0]); Memory.Initialize(); #region PatternScanner if (usePatternScan) { var scan = new SigScan(Memory.Process, Memory.ProcessBaseAddress, Memory.Process.MainModule.ModuleMemorySize); var gnamesPtr = scan.FindPattern(GNamesPatternBytes, GNamesPattern, 0); int offset = Memory.ReadInt32(gnamesPtr, 3); GNamesPtr = Memory.ReadIntPtr(new IntPtr(gnamesPtr.ToInt64() + offset + 7), 0); var gObjectsPtr = scan.FindPattern(GObjectsPatternBytes, GObjectsPattern, 0); offset = Memory.ReadInt32(gObjectsPtr, 3); GObjectsPtr = new IntPtr(gObjectsPtr.ToInt64() + offset + 7); } #endregion Names = new NameStore(GNamesPtr); Objects = new ObjectStore(GObjectsPtr); }
private IntPtr GetScriptContext() { #if DEBUG_ROBLOX Logger.Log(Logger.LogType.WORK, "Attempting to scan for ScriptContext..."); #endif NativeObjects.MemoryBasicInformation mbi; IntPtr baseAdr = this.Native.MainModule.BaseAddress; SigScan sigScan = new SigScan() { Process = this.Native }; for (IntPtr offset = baseAdr; offset.ToInt32() < 0x7FFFFFFF; offset += baseAdr.ToInt32()) { NativeObjects.NativeMethods.VirtualQueryEx(this.Handle, offset, out mbi, Marshal.SizeOf <NativeObjects.MemoryBasicInformation>()); if (mbi.Protect == NativeObjects.MemoryProtectionFlags.ReadWrite) { sigScan.Address = offset; sigScan.Size = mbi.RegionSize; IntPtr result = sigScan.FindPattern(BitConverter.ToString(BitConverter.GetBytes(FixAddress(Offsets.GlobalAddressTable["ScriptContext"].AddressValue.ToInt32()))).Replace("-", " ")); sigScan.ResetRegion(); if (result != IntPtr.Zero) { #if DEBUG_ROBLOX Logger.Log(Logger.LogType.SUCCESS, "Successfully scanned for ScriptContext! SC: 0x{0:X}", result.ToInt32()); #endif return(result); } } baseAdr = (IntPtr)mbi.RegionSize; } #if DEBUG_ROBLOX Logger.Log(Logger.LogType.ERROR, "Failed to scan for ScriptContext"); #endif return(IntPtr.Zero); }
public void runScan() { byte[] pattern = new byte[] { 0x84, 0x05, 0xE0, 0xA2, 0xA8, 0x00, 0x75, 0x24, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00, 0xB9, 0x00, 0x00, 0x00, 0x00, 0xC7, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x83, 0xC4, 0x04, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x4D, 0xF4, 0x64, 0x89, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x59, 0x8B, 0xE5, 0x5D }; //This is the pattern we use to find the base of what we want in memory. Add 0x5c to it to get to the players. string mask = "xxx?xxxxxx????x????xx?????x????x????x????xxxx????xxxxxx????xxxx"; this.SigScan.Address = new IntPtr(0x400000); this.SigScan.Size = 0x900000; //This should be more than enough. IntPtr address = IntPtr.Zero; try { SigScan.Process = Process.GetProcessesByName("SSFIV")[0]; address = SigScan.FindPattern(pattern, mask, 0x2d); } catch { //Error message here. (Couldn't find the process) } SigScan.ResetRegion(); if (address != IntPtr.Zero) { openSF4Process(); playerBase = readIntFromGameMemory(address.ToInt32()) + 0x5c; frameCounterBase = playerBase + 0x24; comboCounterBase = playerBase + 0x4; } else { //Error message here. (Probably wrong pattern/mask) } }
private void InitHeroBaseAddress() { try { IntPtr baseAddress = ProcessMemory.Process.MainModule.BaseAddress; SigScan sigScan = new SigScan(ProcessMemory.Process, IntPtr.Add(baseAddress, 0x580000), 0x20000); IntPtr address = sigScan.FindPattern(new byte[] { 0x48, 0x8B, 0x05, 0xFF, 0xFF, 0xFF, 0xFF, 0x48, 0x85, 0xC0, 0xFF, 0xFF, 0x48, 0x8b, 0x40, 0xFF, 0xC3 }, "xxx????xxx??xxx?x", 0); // Pointer logic from CE: heroBaseAddress = address + ReadMemoryInt(address + 3) + 7 if (!address.Equals(IntPtr.Zero)) { int offset; if (ProcessMemory.ReadMemoryInt(IntPtr.Add(address, 3), out offset)) { _heroBaseAddress = IntPtr.Add(IntPtr.Add(address, offset), 7); } } } catch (Exception e) { Console.WriteLine(e); throw; } }
public IntPtr AoBScan(uint min, int length, string code, string file = "") { string[] stringByteArray = LoadCode(code, file).Split(' '); byte[] myPattern = new byte[stringByteArray.Length]; string mask = ""; int i = 0; foreach (string ba in stringByteArray) { if (ba == "??") { myPattern[i] = 0xFF; mask += "?"; } else { myPattern[i] = Byte.Parse(ba, NumberStyles.HexNumber); mask += "x"; } i++; } SigScan _sigScan = new SigScan(procs, new UIntPtr(min), length); IntPtr pAddr = _sigScan.FindPattern(myPattern, mask, 0); return pAddr; }
private void ScanMemory() { var sigscan = new SigScan(GW2Process, new IntPtr(0x400000), 0xFFFFFF); IntPtr globalbase = sigscan.FindPattern(GlobalBaseB, string.Concat(Enumerable.Repeat("x", GlobalBaseB.Length)), 11); BasePNTR = (IntPtr)(BitConverter.ToInt32(ReadProcessMemory(globalbase, 4), 0) + 0x104); MapIDPNTR = BitConverter.ToInt32(ReadProcessMemory(sigscan.FindPattern(MapIDB, "xxxxxx", 6), 4), 0); sigscan = null; GC.Collect(); try { try { File.Delete(Path.Combine(Path.GetTempPath(), "OverlayUI.dll")); } catch { } File.WriteAllBytes(Path.Combine(Path.GetTempPath(), "OverlayUI.dll"), Resources.hook); } catch { } CommInjected = true; Inject.DllInjectionResult result = Inject.DllInjector.GetInstance.Inject(GW2Process, Path.Combine(Path.GetTempPath(), "OverlayUI.dll")); if (result != Inject.DllInjectionResult.Success && !CheckModule(GW2Process, Path.Combine(Path.GetTempPath(), "OverlayUI.dll"))) { CommInjected = false; } }