public bool TriggerBot() { if (!IsTriggerEnabled) { return(false); } var address = _clientModule.BaseAddress.ToInt32() + (int)Base.MainOffsets.ForceFire; if (IsInCrosshair == 0) { if (_process.Read <byte>(new IntPtr(address), false) == 5) { _process.Write(new IntPtr(address), 4, false); } } if (IsInCrosshair > 0 && IsInCrosshair < 32) { _entity.SingleEntity(IsInCrosshair); if (Team != _entity.Team) { _process.Write(new IntPtr(address), 5, false); return(true); } } return(false); }
private void button1_Click(object sender, EventArgs e) { if (!File.Exists(config.ClientDirectory)) { GetOps(config); } var server = config.Servers.Find(i => i.ServerName == comboBox1.Text); if (server == null) { MessageBox.Show("Error, Check config."); return; } STARTUPINFO si = new STARTUPINFO(); PROCESS_INFORMATION pi = new PROCESS_INFORMATION(); bool success = NativeMethods.CreateProcess(config.ClientDirectory, null, IntPtr.Zero, IntPtr.Zero, false, ProcessCreationFlags.CREATE_SUSPENDED, IntPtr.Zero, null, ref si, out pi); MemorySharp memory; try { memory = new MemorySharp((int)pi.dwProcessId); } catch { MessageBox.Show("This application needs to run as admin."); return; } var payload = new byte[7]; var segments = server.IPAddress.Split('.'); if (server.ClientVersion == 718 && segments.Length == 4) { payload[0] = Convert.ToByte(segments[3]); payload[1] = 0x6A; payload[2] = Convert.ToByte(segments[2]); payload[3] = 0x6A; payload[4] = Convert.ToByte(segments[1]); payload[5] = 0x6A; payload[6] = Convert.ToByte(segments[0]); memory.Write((IntPtr)(0x400000 + server.HookTable), payload, false); memory.Write((IntPtr)(0x400000 + server.PatchTable), payload, false); //kill memory.Write((IntPtr)(0x400000 + server.SplashPtr), 0x87, false); } IntPtr ThreadHandle = pi.hThread; NativeMethods.ResumeThread(ThreadHandle); }
public void PlayReversal() { #if DEBUG Console.WriteLine("Play Reversal"); #endif var fc = FrameCount(); _memorySharp.Write <byte>(_newmembase, _remoteCodeAOB, false); while (FrameCount() < fc + 1) { } _memorySharp.Write <byte>(_newmembase, _originalCodeAOB, false); }
private void numericUpDown_fov_ValueChanged(object sender, EventArgs e) { if (!isDDRunning()) { return; } m.Write <int>(new IntPtr(pFov + 0x14C), (int)((NumericUpDown)sender).Value, false); }
private void button1_Click(object sender, EventArgs e) { if (isValidSequence() && currentoffset != IntPtr.Zero) { var inputs = parseInputs(); ms.Write <int>(currentoffset, inputs); } }
public void waitAndReversal(SlotInput slotInput, int wakeupTiming) { int fc = FrameCount(); var frames = wakeupTiming - slotInput.WakeupFrameIndex - 1; while (FrameCount() < fc + frames) { } lock (_memorySharp) { #if DEBUG Console.WriteLine("Reversal!"); #endif _memorySharp.Write <byte>(_flagmembase, 0, false); Thread.Sleep(320); //20 frames, approximately, it's actually 333.333333333 ms. Nobody should be able to be knocked down and get up in this time, causing the code to execute again. #if DEBUG Console.WriteLine("Reversal Wait Finished!"); #endif } }
private void btnLoadRecording_Click(object sender, EventArgs e) { using (var dialog = new OpenFileDialog { Filter = "Dummy Recording|*.acrdummy", Title = "Load a saved dummy recording", RestoreDirectory = true }) { if (dialog.ShowDialog() == DialogResult.OK) { var recording = File.ReadAllBytes(dialog.FileName); using (MemorySharp sharp = new MemorySharp(process)) { sharp.Write(recordingOffset, recording); } } } }
public void AttachToProcess() { var process = Process.GetProcessesByName(_ggprocname).FirstOrDefault(); if (process == null) { throw new Exception("GG process not found!"); } _memorySharp = new MemorySharp(process); _nonRelativeScriptOffset = IntPtr.Add(_memorySharp.Modules.MainModule.BaseAddress, (int)_scriptOffset); _newmem = _memorySharp.Memory.Allocate(128); _newmembase = _newmem.Information.AllocationBase; var originalCodeAOB = _memorySharp.Assembly.Assembler.Assemble("mov ebp,[ebp+0x0C]\n" + "test [edx],ebp\n" + String.Format("jmp 0x{0}", (_nonRelativeScriptOffset + 5).ToString("X8")), _newmembase); _originalCodeAOB = new byte[originalCodeAOB.Length + 20]; originalCodeAOB.CopyTo(_originalCodeAOB, 0); _remoteCodeAOB = _memorySharp.Assembly.Assembler.Assemble(String.Format("mov ebp,[ebp+0x0C]\n" + "cmp edi,3\n" + "jne 0x{0}\n" + "mov ebp,[edx]\n" + "test [edx],ebp\n" + "jmp 0x{1}", IntPtr.Add(_newmembase, 0xA).ToString("X8"), (_nonRelativeScriptOffset.ToInt32() + 5).ToString("X8")), _newmembase); _memorySharp.Write <byte>(_newmembase, _originalCodeAOB, false); }
/// <summary> /// Patches the value inside the running process memory /// with the value of the given YuGiValue /// </summary> /// <param name="value">YuGiValue that will be patched inside memory</param> public static void PatchMemory(YuGiValue value) { if (_instance == null) { return; } if (MemorySharp == null) { return; } try { MemorySharp.Write((IntPtr)value.Offset, value.Value); } catch (Exception e) { MessageBox.Show("Critical Error!\n\r\n\rDid you just closed the Game?\n\rApplication will now close!\n\r" + e); Application.Exit(); return; } }
public void AttachToProcess() { var process = Process.GetProcessesByName(_ggprocname).FirstOrDefault(); if (process == null) { throw new Exception("GG process not found!"); } _memorySharp = new MemorySharp(process); _nonRelativeScriptOffset = IntPtr.Add(_memorySharp.Modules.MainModule.BaseAddress, (int)_scriptOffset); _newmem = _memorySharp.Memory.Allocate(128); _newmembase = _newmem.Information.AllocationBase; _flagmem = _memorySharp.Memory.Allocate(128); _flagmembase = _flagmem.Information.AllocationBase; var remoteASMstring = String.Format("mov ebp,[eax+0x40]\n" + "mov ebp,[ebp+0x0C]\n" + "cmp edi,3\n" + "jne 0x{0}\n" + "cmp BYTE [0x{2}], 1\n" + "je 0x{3}\n" + "mov DWORD [0x{4}], 0x200\n" + "and DWORD [0x{4}], eax\n" + "cmp DWORD [0x{4}], 0x200\n" + "jne 0x{0}\n" + "mov DWORD [0x{4}], eax\n" + "mov BYTE [0x{2}], 1\n" + "jmp 0x{0}\n" + "cmp DWORD [0x{4}], eax\n" + "jne 0x{0}\n" + "cmp BYTE [0x{1}],0\n" + "jne 0x{0}\n" + "mov ebp,[edx]\n" + "mov BYTE [0x{1}], 1\n" + "jmp 0x{0}", (_nonRelativeScriptOffset.ToInt32() + 6).ToString("X8"), _flagmembase.ToString("X8"), IntPtr.Add(_flagmembase, 1).ToString("X8"), IntPtr.Add(_newmembase, 0x49).ToString("X8"), IntPtr.Add(_flagmembase, 4).ToString("X8")); _remoteCodeAOB = _memorySharp.Assembly.Assembler.Assemble(remoteASMstring, _newmembase); _memorySharp.Write <byte>(_newmembase, _remoteCodeAOB, false); }
internal static void Write <T>(uint address, T value) { process.Write <T>(new IntPtr(address), value, false); }
private void frmMain_Load_1(object sender, EventArgs e) { var daPath = @"C:\ProgramData\Lorule\7.18\Darkages.exe"; var server = config.Servers[config.SelectedIndex]; STARTUPINFO si = new STARTUPINFO(); PROCESS_INFORMATION pi = new PROCESS_INFORMATION(); bool success = NativeMethods.CreateProcess(daPath, null, IntPtr.Zero, IntPtr.Zero, false, ProcessCreationFlags.CREATE_SUSPENDED, IntPtr.Zero, null, ref si, out pi); MemorySharp memory; try { memory = new MemorySharp((int)pi.dwProcessId); } catch (Exception error) { MessageBox.Show(string.Format("Fatal Launch Error: {0}", error.Message + "\n" + error.StackTrace)); File.WriteAllText("lorule_lerror.txt", string.Format("Fatal Launch Error: {0}", error.Message + "\n" + error.StackTrace)); return; } var payload = new byte[7]; var segments = server.IPAddress.Split('.'); if (server.IPAddress.Contains(".com") || server.IPAddress.Contains("www.") || segments.Length != 4) { var ip = Dns.GetHostAddresses(server.IPAddress)[0]; var ipString = ip.ToString(); payload[0] = Convert.ToByte(ipString[3]); payload[1] = 0x6A; payload[2] = Convert.ToByte(ipString[2]); payload[3] = 0x6A; payload[4] = Convert.ToByte(ipString[1]); payload[5] = 0x6A; payload[6] = Convert.ToByte(ipString[0]); memory.Write((IntPtr)(0x400000 + server.HookTable), payload, false); memory.Write((IntPtr)(0x400000 + server.PatchTable), payload, false); } else { if (server.ClientVersion == 718 && segments.Length == 4) { payload[0] = Convert.ToByte(segments[3]); payload[1] = 0x6A; payload[2] = Convert.ToByte(segments[2]); payload[3] = 0x6A; payload[4] = Convert.ToByte(segments[1]); payload[5] = 0x6A; payload[6] = Convert.ToByte(segments[0]); memory.Write((IntPtr)(0x400000 + server.HookTable), payload, false); memory.Write((IntPtr)(0x400000 + server.PatchTable), payload, false); } } IntPtr ThreadHandle = pi.hThread; NativeMethods.ResumeThread(ThreadHandle); CheckAdmin(); try { var Memory = new MemorySharp((int)pi.dwProcessId); { var injection = Memory.Modules.Inject(LOR_DLL); if (injection.IsValid) { Console.Beep(); } } } catch { } }
/// <summary> /// Assembles mnemonics and injects the corresponding assembly code into the remote process at the specified address. /// </summary> /// <param name="asm">The mnemonics to inject.</param> /// <param name="address">The address where the assembly code is injected.</param> public void Inject(string asm, IntPtr address) { MemorySharp.Write(address, Assembler.Assemble(asm, address), false); }
private void TeleportToDestination() { if (GameProcess != null) { if (GameProcess.IsRunning == true) { PointerAddress = GameProcess.Read <int>(CharacterPointers.CurrentCharacter); if (PointerAddress != 0) { GameProcess.Write <float>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.XVelocity), CurrentWarps[MenuWarpIndex].XVelocity, false); GameProcess.Write <float>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.YVelocity), CurrentWarps[MenuWarpIndex].YVelocity, false); GameProcess.Write <float>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.ZVelocity), CurrentWarps[MenuWarpIndex].ZVelocity, false); GameProcess.Write <float>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.XPosition), CurrentWarps[MenuWarpIndex].XPosition, false); GameProcess.Write <float>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.YPosition), CurrentWarps[MenuWarpIndex].YPosition, false); GameProcess.Write <float>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.ZPosition), CurrentWarps[MenuWarpIndex].ZPosition, false); GameProcess.Write <ushort>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.XRotation), CurrentWarps[MenuWarpIndex].XRotation, false); GameProcess.Write <ushort>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.YRotation), CurrentWarps[MenuWarpIndex].YRotation, false); GameProcess.Write <ushort>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.ZRotation), CurrentWarps[MenuWarpIndex].ZRotation, false); GameProcess.Write <float>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.XCharacterThickness), CurrentWarps[MenuWarpIndex].XCharacterThickness, false); GameProcess.Write <float>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.YCharacterThickness), CurrentWarps[MenuWarpIndex].YCharacterThickness, false); GameProcess.Write <float>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.TeamMatesFollowingSomething), CurrentWarps[MenuWarpIndex].TeamMatesFollowingSomething, false); GameProcess.Write <float>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.TeamMatesFollowingSomething2), CurrentWarps[MenuWarpIndex].TeamMatesFollowingSomething2, false); GameProcess.Write <float>((IntPtr)(PointerAddress + (int)CharacterPointerOffsets.TeamMatesFollowingSomething3), CurrentWarps[MenuWarpIndex].TeamMatesFollowingSomething3, false); } } } }
public void Write <T>(IntPtr Address, T value) { mem.Write <T>(Address, value); }
public static void Inject(int offset, string[] mnemonics, bool isRelative = true) { var asmBytes = Generate(mnemonics, offset); MemorySharp.Write((IntPtr)offset, asmBytes, isRelative); }
public void Write <T>(IntPtr address, T value, bool isRelative = true) { m.Write <T>(address, value, isRelative); }
private void HOTKEYS() { if (!pcsx2Running) { return; } //Numpad Brightness Toggle ON (NUMPAD 1) if (GetAsyncKeyState(Keys.NumPad1) < 0) { var cheatString = @"204B858C 40800000 204B859C 40800000 204B85AC 40800000"; var cheat = ParseCheat(cheatString); foreach (var code in cheat.Codes) { m.Write <int>(code.Address, code.Data, false); } } //Numpad Brightness Toggle OFF (NUMPAD 0) if (GetAsyncKeyState(Keys.NumPad0) < 0) { var cheatString = @"204B858C 00000000 204B859C 00000000 204B85AC 00000000"; var cheat = ParseCheat(cheatString); foreach (var code in cheat.Codes) { m.Write <int>(code.Address, code.Data, false); } } //Brightness Adjustments (NUMPAD +) if (GetAsyncKeyState(Keys.Add) < 0) { IntPtr address = GameHelper.BRIGHTNESS1; float oldValue = m.Read <float>(address, false); float newValue = oldValue + 2; m.Write(address, value: newValue, false); } //Brightness Adjustments (NUMPAD -) if (GetAsyncKeyState(Keys.Subtract) < 0) { IntPtr address = GameHelper.BRIGHTNESS1; float oldValue = m.Read <float>(address, false); float newValue = oldValue - 2; m.Write(address, value: newValue, false); } //Lock Perfect Brightness if (lockBrightness_checkBox.Checked) { if (!pcsx2Running) { return; } var cheatString = @"204B858C 40500000 204B859C 40500000 204B85AC 40500000"; var cheat = ParseCheat(cheatString); foreach (var code in cheat.Codes) { m.Write <int>(code.Address, code.Data, false); } } }
public static void WriteInfoInt(ref Player player, int offset, int value) { IntPtr ptr = _memorySharp[player._playerPtr].Read <IntPtr>(); _memorySharp.Write <int>(ptr + offset, value, false); }