internal Detour(Delegate target, Delegate hook, string name, MemoryBase memory) { _memory = memory; Name = name; _targetDelegate = target; _target = Marshal.GetFunctionPointerForDelegate(target); _hookDelegate = hook; _hook = Marshal.GetFunctionPointerForDelegate(hook); //Store the orginal bytes _orginal = new List <byte>(); _orginal.AddRange(memory.ReadBytes(_target, 6)); //Setup the detour bytes _new = new List <byte> { 0x68 }; var tmp = BitConverter.GetBytes(_hook.ToInt32()); _new.AddRange(tmp); _new.Add(0xC3); var parHack = new Hack(_target, _orginal.ToArray(), _new.ToArray(), Name); HookWardenMemScan.AddHack(parHack); }
private void btn_ToggleWallClimb_Click(object sender, EventArgs e) { Hack wallClimb = HookWardenMemScan.GetHack("WallClimbPatch"); //setup wall climb patch if unknown to us if (wallClimb == null) { float wc = 0.5f; var wallClimbPatch = new Hack(ZzukBot.Constants.Offsets.Hacks.Wallclimb, BitConverter.GetBytes(wc), "WallClimbPatch"); HookWardenMemScan.AddHack(wallClimbPatch); wallClimb = HookWardenMemScan.GetHack("WallClimbPatch"); } #region toggle wall climb if (!wallClimb.IsActivated) { wallClimb.Apply(); return; } wallClimb.Remove(); #endregion }
/// <summary> /// Initialise InternalMemoryReader /// </summary> internal static void Init() { Reader = new InProcessMemoryReader(Process.GetCurrentProcess()); Asm = new FasmNet(); // Init the object manager ObjectManager.Init(); SetupHideModules((IntPtr)Process.GetCurrentProcess().Id); // Apply no collision hack with trees Hack Collision1 = new Hack((IntPtr)0x6ABC5A, new byte[] { 0x0F, 0x85, 0x1B, 0x01, 0x00, 0x00 }, "Collision1"); HookWardenMemScan.AddHack(Collision1); Hack Collision2 = new Hack((IntPtr)0x006A467B, new byte[] { 0x90, 0x90 }, "Collision2"); HookWardenMemScan.AddHack(Collision2); Hack Collision3 = new Hack((IntPtr)0x006ABF13, new byte[] { 0xEB, 0x69 }, "Collision3"); HookWardenMemScan.AddHack(Collision3); ////DisableCollision.Apply(); // wallclimb hack yay :) //Hack Wallclimb = new Hack((IntPtr)0x0080DFFC, new byte[] { 0x00, 0x00, 0x00, 0x00 }, "Wallclimb"); //HookWardenMemScan.AddHack(Wallclimb); // Loot patch Hack LootPatch = new Hack((IntPtr)0x004C21C0, new byte[] { 0xEB }, "LootPatch"); HookWardenMemScan.AddHack(LootPatch); //LootPatch.Apply(); // Lua Unlock Hack LuaUnlock = new Hack((IntPtr)0x494a57, new byte[] { 0xB8, 0x01, 0x00, 0x00, 0x00, 0xc3 }, "LuaUnlock"); HookWardenMemScan.AddHack(LuaUnlock); LuaUnlock.Apply(); //Hack Superfly = new Hack((IntPtr)0x006341BC, new byte[] { 0x90, 0x90 }, "Superfly"); //HookWardenMemScan.AddHack(Superfly); //Hack Antijump = new Hack((IntPtr)0x007C625F, new byte[] { 0xEB }, "Antijump"); //HookWardenMemScan.AddHack(Antijump); // See all levels & no language barrier Hack SeeAllLevels = new Hack((IntPtr)0x5EC720, new byte[] { 0xC2, 0x08, 0x00 }, new byte[] { 0x55, 0x8b, 0xec }, "SeeAllLevels"); HookWardenMemScan.AddHack(SeeAllLevels); SeeAllLevels.Apply(); // crasher Hack UnderstandAll = new Hack((IntPtr)0x518062, new byte[] { 0xEB }, new byte[] { 0x7F }, "UnderstandAll"); HookWardenMemScan.AddHack(UnderstandAll); UnderstandAll.Apply(); }
//internal static void InjectAsm(uint parPtr, string[] parInstructions, string parPatchName = "") //{ // if (Asm == null) Asm = new FasmNet(); // Asm.Clear(); // IntPtr start = new IntPtr(parPtr); // Asm.AddLine("use32"); // foreach (string x in parInstructions) // { // Asm.AddLine(x); // } // byte[] byteCode = new byte[0]; // try // { // byteCode = Asm.Assemble(start); // } // catch (FasmAssemblerException ex) // { // MessageBox.Show(String.Format("Error definition: {0}; Error code: {1}; Error line: {2}; Error offset: {3}; Mnemonics: {4}", // ex.ErrorCode, (int)ex.ErrorCode, ex.ErrorLine, ex.ErrorOffset, ex.Mnemonics)); // } // byte[] originalBytes = Memory.Reader.ReadBytes((IntPtr)start, byteCode.Length); // Memory.Reader.WriteBytes(start, byteCode); // if (parPatchName != "") // { // Hack parHack = new Hack(start, // byteCode, // originalBytes, parPatchName); // HookWardenMemScan.AddHack(parHack); // } //} //[Obfuscation(Feature = "virtualization", Exclude = false)] internal static IntPtr InjectAsm(string[] parInstructions, string parPatchName) { if (Asm == null) { Asm = new FasmNet(); } Asm.Clear(); Asm.AddLine("use32"); foreach (var x in parInstructions) { Asm.AddLine(x); } var byteCode = new byte[0]; try { byteCode = Asm.Assemble(); } catch (FasmAssemblerException ex) { MessageBox.Show( $"Error definition: {ex.ErrorCode}; Error code: {(int)ex.ErrorCode}; Error line: {ex.ErrorLine}; Error offset: {ex.ErrorOffset}; Mnemonics: {ex.Mnemonics}"); } var start = Reader.Alloc(byteCode.Length); Asm.Clear(); Asm.AddLine("use32"); foreach (var x in parInstructions) { Asm.AddLine(x); } byteCode = Asm.Assemble(start); HookWardenMemScan.RemoveHack(start); HookWardenMemScan.RemoveHack(parPatchName); var originalBytes = Reader.ReadBytes(start, byteCode.Length); if (parPatchName != "") { var parHack = new Hack(start, byteCode, originalBytes, parPatchName); HookWardenMemScan.AddHack(parHack); Console.WriteLine($"Protecting {parHack.Name} from Warden at {parHack.Address.ToString("X")}"); parHack.Apply(); } else { Reader.WriteBytes(start, byteCode); } return(start); }
private void StopGrinder(ref int FrameCounter, bool IsIngame) { Memory.GetHack("Ctm").Remove(); if (IsIngame) { // disable all current ingame movements if we are ingame ObjectManager.Player.CtmStopMovement(); } HookWardenMemScan.GetHack("Collision3").Remove(); HookWardenMemScan.GetHack("Collision").Remove(); // we arent running anymore Access = null; ErrorEnumHook.OnNewError -= ErrorEnum_OnNewError; DirectX.StopRunning(); }
private void Resurrect() { if (Wait.For("ResurrectTimer112", 500)) { if (ObjectManager.Player.TimeUntilResurrect == 0) { if (HookWardenMemScan.GetHack("Collision").IsActivated) { HookWardenMemScan.GetHack("Collision").Remove(); ObjectManager.Player.CtmStopMovement(); Grinder.Access.Info.Rest.ForceRest(); } Functions.DoString("RetrieveCorpse()"); } } }
private DirectX() { Console.WriteLine("DirectX applied"); var vTable = GetEndScene.Instance.ToVTablePointer(); _endSceneOriginal = Memory.Reader.RegisterDelegate <Direct3D9EndScene>(vTable.ReadAs <IntPtr>()); _endSceneDetour = new Direct3D9EndScene(EndSceneHook); var addrToDetour = Marshal.GetFunctionPointerForDelegate(_endSceneDetour); _mtId = Process.GetCurrentProcess().Threads[0].Id; var directXvTableHook = new Hack(vTable, BitConverter.GetBytes((int)addrToDetour), "DirectXVTableHook"); HookWardenMemScan.AddHack(directXvTableHook); directXvTableHook.Apply(); }
private static void ToggleHack(string hack, bool state) { var hackInstance = HookWardenMemScan.GetHack(hack); if (hackInstance == null) { return; } if (state) { hackInstance.Apply(); } else { hackInstance.Remove(); } }
internal static void InjectAsm(uint parPtr, string[] parInstructions, string parPatchName) { Asm.Clear(); Asm.AddLine("use32"); foreach (var item in parInstructions) { Asm.AddLine(item); } var start = new IntPtr(parPtr); byte[] byteCode; try { byteCode = Asm.Assemble(start); } catch (FasmAssemblerException ex) { MessageBox.Show( $"Error definition: {ex.ErrorCode}; Error code: {(int)ex.ErrorCode}; Error line: {ex.ErrorLine}; Error offset: {ex.ErrorOffset}; Mnemonics: {ex.Mnemonics}"); return; } HookWardenMemScan.RemoveHack(start); HookWardenMemScan.RemoveHack(parPatchName); var originalBytes = Reader.ReadBytes(start, byteCode.Length); if (parPatchName != "") { var parHack = new Hack(start, byteCode, originalBytes, parPatchName); HookWardenMemScan.AddHack(parHack); parHack.Apply(); } else { Reader.WriteBytes(start, byteCode); } }
internal void EndLaunchPrepare() { Memory.Init(); SettingsManager.LoadSettings(); CCManager.LoadCCs(); #region set wow & bot window location and size Helpers.WindowInteraction.SetWowWindow(); Helpers.WindowInteraction.SetBotWindow(); #endregion #region setup world render minimize if enabled in settings if (Settings.Settings.MinimizeWorldRender) { Hack renderWorld = HookWardenMemScan.GetHack("RenderWorlObjectsPatch"); //setup render world patch if unknown to us if (renderWorld == null) { var RenderWorldPatch = new Hack(ZzukBot.Constants.Offsets.Hacks.RenderDisable, new byte[] { 0x00 }, "RenderWorlObjectsPatch"); HookWardenMemScan.AddHack(RenderWorldPatch); renderWorld = HookWardenMemScan.GetHack("RenderWorlObjectsPatch"); } if (!renderWorld.IsActivated && Settings.Settings.MinimizeWorldRender) { renderWorld.Apply(); } } #endregion IrcMonitor.Instance.MessageReceived += ChannelMessageRecieved; GuiCore.SettingsForm.SetupIrc(); Enums.DynamicFlags.AdjustToRealm(); GuiCore.MainForm.Enabled = true; ChatHook.OnNewChatMessage += updateChat; LoginBlock.Disable(); }
private void btnToggleRender_Click(object sender, EventArgs e) { Hack renderWorld = HookWardenMemScan.GetHack("RenderWorlObjectsPatch"); //setup render world patch if unknown to us if (renderWorld == null) { var RenderWorldPatch = new Hack(ZzukBot.Constants.Offsets.Hacks.RenderDisable, new byte[] { 0x00 }, "RenderWorlObjectsPatch"); HookWardenMemScan.AddHack(RenderWorldPatch); renderWorld = HookWardenMemScan.GetHack("RenderWorlObjectsPatch"); } #region toggle render world if (!renderWorld.IsActivated && Settings.Settings.MinimizeWorldRender) { renderWorld.Apply(); return; } renderWorld.Remove(); #endregion }
internal unsafe Spells() { var tmpPlayerSpells = new Dictionary <string, uint[]>(); uint currentPlayerSpellPtr = 0x00B700F0; uint index = 0; while (index < 1024) { var currentSpellId = *(uint *)(currentPlayerSpellPtr + 4 * index); if (currentSpellId == 0) { break; } var entryPtr = *(uint *)(*(uint *)(0x00C0D780 + 8) + currentSpellId * 4); var entrySpellId = *(uint *)entryPtr; var namePtr = *(uint *)(entryPtr + 0x1E0); //var name = Memory.Reader.ReadString((IntPtr) namePtr, Encoding.ASCII); var name = namePtr.ReadString(); // Will default to ascii if (tmpPlayerSpells.ContainsKey(name)) { var tmpIds = new List <uint>(); tmpIds.AddRange(tmpPlayerSpells[name]); tmpIds.Add(entrySpellId); tmpPlayerSpells[name] = tmpIds.ToArray(); } else { uint[] ranks = { entrySpellId }; tmpPlayerSpells.Add(name, ranks); } index += 1; } PlayerSpells = tmpPlayerSpells; Hack tmpHack; if (PlayerSpells.ContainsKey(AutoShot)) { if ((tmpHack = HookWardenMemScan.GetHack("AutoShotPlace")) == null) { tmpHack = new Hack((IntPtr)0xBC69D4, BitConverter.GetBytes(AutoShotId), "AutoShotPlace"); tmpHack.Apply(); HookWardenMemScan.AddHack(tmpHack); } else { tmpHack.Apply(); } } if (PlayerSpells.ContainsKey(Wand)) { if ((tmpHack = HookWardenMemScan.GetHack("WandPlace")) == null) { tmpHack = new Hack((IntPtr)0x00BC69D8, BitConverter.GetBytes(WandId), "WandPlace"); tmpHack.Apply(); HookWardenMemScan.AddHack(tmpHack); } else { tmpHack.Apply(); } } if ((tmpHack = HookWardenMemScan.GetHack("AttackPlace")) == null) { tmpHack = new Hack((IntPtr)0xBC69DC, BitConverter.GetBytes(AttackId), "AttackPlace"); tmpHack.Apply(); HookWardenMemScan.AddHack(tmpHack); } else { tmpHack.Apply(); } }
private void ApplyActionbarHacks() { Hack tmpHack; if (PlayerSpells.ContainsKey(BowShoot)) { if ((tmpHack = HookWardenMemScan.GetHack("BowShootPlace")) == null) { tmpHack = new Hack((IntPtr)0xBC69CC, BitConverter.GetBytes(ShootBowId), "BowShootPlace"); tmpHack.Apply(); HookWardenMemScan.AddHack(tmpHack); } else { tmpHack.Apply(); } } if (PlayerSpells.ContainsKey(CrossBowShoot)) { if ((tmpHack = HookWardenMemScan.GetHack("CrossbowShootPlace")) == null) { tmpHack = new Hack((IntPtr)0xBC69D0, BitConverter.GetBytes(ShootCrossbowId), "CrossbowShootPlace"); tmpHack.Apply(); HookWardenMemScan.AddHack(tmpHack); } else { tmpHack.Apply(); } } if (PlayerSpells.ContainsKey(AutoShot)) { if ((tmpHack = HookWardenMemScan.GetHack("AutoShotPlace")) == null) { tmpHack = new Hack((IntPtr)0xBC69D4, BitConverter.GetBytes(AutoShotId), "AutoShotPlace"); tmpHack.Apply(); HookWardenMemScan.AddHack(tmpHack); } else { tmpHack.Apply(); } } if (PlayerSpells.ContainsKey(Wand)) { if ((tmpHack = HookWardenMemScan.GetHack("WandPlace")) == null) { tmpHack = new Hack((IntPtr)0x00BC69D8, BitConverter.GetBytes(WandId), "WandPlace"); tmpHack.Apply(); HookWardenMemScan.AddHack(tmpHack); } else { tmpHack.Apply(); } } if ((tmpHack = HookWardenMemScan.GetHack("AttackPlace")) == null) { tmpHack = new Hack((IntPtr)0xBC69DC, BitConverter.GetBytes(AttackId), "AttackPlace"); tmpHack.Apply(); HookWardenMemScan.AddHack(tmpHack); } else { tmpHack.Apply(); } }
internal static Hack GetHack(string parName) { return(HookWardenMemScan.GetHack(parName)); }
internal static void Init() { if (Applied) { return; } $"Initialising singletons".Log(LogFiles.InjectedLog, true); App.Singleton.Initialise(); $"Hiding patches from warden".Log(LogFiles.InjectedLog, true); var DisableCollision = new Hack(Offsets.Hacks.DisableCollision, new byte[] { 0x0F, 0x85, 0x1B, 0x01, 0x00, 0x00 }, "Collision"); HookWardenMemScan.AddHack(DisableCollision); //DisableCollision.Apply(); // Ctm Patch var CtmPatch = new Hack(Offsets.Hacks.CtmPatch, new byte[] { 0x00, 0x00, 0x00, 0x00 }, "Ctm"); HookWardenMemScan.AddHack(CtmPatch); //CtmPatch.Apply(); // wallclimb hack yay :) //float wc = 0.5f; //Hack Wallclimb = new Hack(Hacks.Wallclimb, BitConverter.GetBytes(wc), "Wallclimb"); //HookWardenMemScan.AddHack(Wallclimb); //Wallclimb.Apply(); var Collision3 = new Hack(Offsets.Hacks.Collision3, new byte[] { 0xEB, 0x69 }, "Collision3"); HookWardenMemScan.AddHack(Collision3); // Loot patch var LootPatch = new Hack(Offsets.Hacks.LootPatch, new byte[] { 0xEB }, "LootPatch"); HookWardenMemScan.AddHack(LootPatch); LootPatch.Apply(); var LootPatch2 = new Hack(Offsets.Hacks.LootPatch2, new byte[] { 0xEB }, "LootPatch2"); HookWardenMemScan.AddHack(LootPatch2); LootPatch2.Apply(); // Ctm Hide var CtmHide = new Hack(Offsets.Player.CtmState, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x0C, 0x00, 0x00, 0x00 }, "CtmHideHack") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHide); var CtmHideX = new Hack(Offsets.Player.CtmX, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 }, "CtmHideHackX") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHideX); var CtmHideY = new Hack(Offsets.Player.CtmY, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 }, "CtmHideHackY") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHideY); var CtmHideZ = new Hack(Offsets.Player.CtmZ, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 }, "CtmHideHackZ") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHideZ); // Lua Unlock var LuaUnlock = new Hack(Offsets.Hacks.LuaUnlock, new byte[] { 0xB8, 0x01, 0x00, 0x00, 0x00, 0xc3 }, "LuaUnlock"); HookWardenMemScan.AddHack(LuaUnlock); LuaUnlock.Apply(); //ErasePeHeader("Loader.dll"); //UnlinkFromPeb("Loader.dll"); Hacks.Instance.AntiCtmStutter = true; Applied = true; }
private static bool IsHackActive(string hack) { var hackInstance = HookWardenMemScan.GetHack(hack); return(hackInstance != null && hackInstance.IsActivated); }
internal static void Init() { if (Applied) { return; } // Init Warden Module32First/Next hook //MessageBox.Show("TEST"); //var snapshot = WinImports.CreateToolhelp32Snapshot(0x00000010 | 0x00000008, (uint) Reader.Process.Id); //var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //var entry = new WinImports.MODULEENTRY32() { dwSize = 548 }; //if (WinImports.Module32First(snapshot, ref entry)) //{ // entry = new WinImports.MODULEENTRY32() { dwSize = 548 }; // while (WinImports.Module32Next(snapshot, ref entry)) // { // if (entry.szExePath.Contains(basePath)) // Reader.WriteBytes(entry.modBaseAddr, new byte[] {0, 0, 0, 0}); // } //} HookModule32.Init(); Libs.Clear(); Libs.InjectFastcall(); Libs.ReloadNav(); ErrorEnumHook.Init(); ChatHook.Init(); GlobalHooks.Init(); //EnterWorldHook.Init(); //EnterWorldCompleteHook.Init(); WindowProcHook.Init(); HookWardenMemScan.SetupDetour(); // Init DirectX DirectX.Init(); // Init the object manager ObjectManager.Init(); // Apply no collision hack with trees var DisableCollision = new Hack(Hacks.DisableCollision, new byte[] { 0x0F, 0x85, 0x1B, 0x01, 0x00, 0x00 }, "Collision"); HookWardenMemScan.AddHack(DisableCollision); //DisableCollision.Apply(); // Ctm Patch var CtmPatch = new Hack(Hacks.CtmPatch, new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }, "Ctm"); HookWardenMemScan.AddHack(CtmPatch); //CtmPatch.Apply(); // wallclimb hack yay :) //float wc = 0.5f; //Hack Wallclimb = new Hack(Hacks.Wallclimb, BitConverter.GetBytes(wc), "Wallclimb"); //HookWardenMemScan.AddHack(Wallclimb); //Wallclimb.Apply(); var Collision3 = new Hack(Hacks.Collision3, new byte[] { 0xEB, 0x69 }, "Collision3"); HookWardenMemScan.AddHack(Collision3); // Loot patch var LootPatch = new Hack(Hacks.LootPatch, new byte[] { 0xEB }, "LootPatch"); HookWardenMemScan.AddHack(LootPatch); LootPatch.Apply(); #region Ctm Hide var CtmHide = new Hack(Player.CtmState, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x0C, 0x00, 0x00, 0x00 }, "CtmHideHack") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHide); var CtmHideX = new Hack(Player.CtmX, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 }, "CtmHideHackX") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHideX); var CtmHideY = new Hack(Player.CtmY, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 }, "CtmHideHackY") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHideY); var CtmHideZ = new Hack(Player.CtmZ, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 }, "CtmHideHackZ") { DynamicHide = true }; HookWardenMemScan.AddHack(CtmHideZ); #endregion // Lua Unlock var LuaUnlock = new Hack(Hacks.LuaUnlock, new byte[] { 0xB8, 0x01, 0x00, 0x00, 0x00, 0xc3 }, "LuaUnlock"); HookWardenMemScan.AddHack(LuaUnlock); LuaUnlock.Apply(); #if !DEBUG Hack DisableErrorSpam = new Hack((IntPtr)0x00496810, new byte[] { 0xB9, 0x04, 0x00, 0x00, 0x00, 0x90 }, "ErrorSpamDisable"); HookWardenMemScan.AddHack(DisableErrorSpam); DisableErrorSpam.Apply(); #endif Applied = true; }