private void Quit() { m.CloseProcess(); // Close main process Environment.Exit(0); }
static void Main(string[] args) => EditMemory(); //pls do it this way so i wont feel like i wasted my time understanding how to hack program's memory //static void Main(string[] args) => WriteFromFile(args[0]); static void EditMemory() { Process aottg = (from proc in Process.GetProcesses() where proc.MainWindowTitle == "ATTACK_ON_TITAN" select proc).FirstOrDefault(); //get aottg process by process window title while (aottg == null) { Console.WriteLine("No process found"); Thread.Sleep(10000); //wait 10s and try again aottg = (from proc in Process.GetProcesses() where proc.MainWindowTitle == "ATTACK_ON_TITAN" select proc).FirstOrDefault(); } Console.WriteLine("Process found!"); memoryEditor.OpenProcess(aottg.Id); //attach our memory editor to the process using its PID Task <IEnumerable <long> > scan = memoryEditor.AoBScan(appID_bytes, true, false); //scans for an array of bytes in memory. we want to get old appID address and modify its value so we gotta scan for appID bytes scan.Wait(); //wait for task to finish foreach (long address in scan.Result) //now lets try to write the new appID in the addresses we got { //string prev = Encoding.Unicode.GetString(memoryEditor.ReadBytes(address.ToHex(), Encoding.Unicode.GetBytes(oldAppID).Length)); if (!memoryEditor.WriteMemory(address.ToHex(), "string", newAppID, "", Encoding.Unicode)) { Console.WriteLine($"Failed writing address {address.ToHex()}"); } else { Console.WriteLine($"Done! Written new AppID in address {address.ToHex()}"); } //Console.WriteLine($"Done! Address {address.ToHex()} written\n(old value: {prev} | updated value: {Encoding.Unicode.GetString(memoryEditor.ReadBytes(address.ToHex(), Encoding.Unicode.GetBytes(newAppID).Length))})"); } Console.WriteLine("You should be able to connect to new servers now"); memoryEditor.CloseProcess(); Console.ReadKey(); }
private void DetachFromProcess() { try { p = null; MCCMemory.CloseProcess(); attachToProcessToolStripMenuItem.Text = "Attach to process"; attached = false; } catch { MessageBox.Show("Couldn't Detach"); } }
// Main entrypoint private static int Main(string[] args) { // Launch doom with the passed arguments string launchArgs = String.Join(" ", args); var doom = Process.Start("DOOMx64vk.exe", launchArgs); if (doom == null) { Console.WriteLine("Failed to open the DOOM process!"); return(1); } // Wait for the original Steam process to exit doom.WaitForExit(); // Wait for the DOOM process to be re-opened int pId = 0; SpinWait.SpinUntil(() => (pId = Memory.GetProcIdFromName("DOOMx64vk")) != 0); if (Memory.OpenProcess(pId)) { // Wait until the memory is loaded SpinWait.SpinUntil(() => { var bytesRead = Memory.ReadBytes("DOOMx64vk.exe+18a31d0", 7); if (bytesRead == null) { return(false); } return(BitConverter.ToString(bytesRead) == "0F-B6-81-89-4C-03-00"); }); // Apply the patch and close the process Memory.WriteMemory("DOOMx64vk.exe+18a31d0", "bytes", "31 C0 90 90 90 90 90"); Memory.CloseProcess(); Console.WriteLine("DOOM process has been patched successfully."); return(0); } else { Console.WriteLine("Failed to patch the DOOM process!"); return(1); } }