Exemplo n.º 1
0
        public string GetLocalizedText(string variable)
        {
            AmeisenBotLogger.Instance.Log($"[{ProcessId.ToString("X", CultureInfo.InvariantCulture.NumberFormat)}]\tReading Lua variable \"{variable}\"", LogLevel.Verbose);
            if (variable.Length > 0)
            {
                byte[]           bytes    = Encoding.UTF8.GetBytes(variable);
                MemoryAllocation memAlloc = TrashMem.AllocateMemory(bytes.Length + 1);
                if (memAlloc == null)
                {
                    return("");
                }

                TrashMem.WriteBytes(memAlloc.Address, bytes);

                string[] asmLocalText = new string[]
                {
                    $"CALL 0x{OffsetList.FunctionGetActivePlayerObject.ToString("X")}",
                    "MOV ECX, EAX",
                    "PUSH -1",
                    $"PUSH 0x{memAlloc.Address.ToString("X")}",
                    $"CALL 0x{OffsetList.FunctionGetLocalizedText.ToString("X")}",
                    "RETN",
                };

                string result = Encoding.UTF8.GetString(InjectAndExecute(asmLocalText, true));
                TrashMem.FreeMemory(memAlloc);
                return(result);
            }
            return("");
        }
Exemplo n.º 2
0
        private void DisposeHook()
        {
            if (IsWoWHooked)
            {
                AmeisenBotLogger.Instance.Log($"[{ProcessId.ToString("X", CultureInfo.InvariantCulture.NumberFormat)}]\tDisposing Hook", LogLevel.Verbose);
                TrashMem.WriteBytes(EndsceneAddress, originalEndsceneBytes);

                if (CodecaveForCheck != null)
                {
                    TrashMem.FreeMemory(CodecaveForCheck);
                }

                if (CodecaveForExecution != null)
                {
                    TrashMem.FreeMemory(CodecaveForExecution);
                }

                if (CodeToExecuteAddress != null)
                {
                    TrashMem.FreeMemory(CodeToExecuteAddress);
                }

                if (ReturnValueAddress != null)
                {
                    TrashMem.FreeMemory(ReturnValueAddress);
                }
            }
        }
Exemplo n.º 3
0
        public void LuaDoString(string command)
        {
            AmeisenBotLogger.Instance.Log($"[{ProcessId.ToString("X", CultureInfo.InvariantCulture.NumberFormat)}]\tExecuting Lua \"{command}\"", LogLevel.Verbose);
            if (command.Length > 0)
            {
                byte[]           bytes    = Encoding.UTF8.GetBytes(command);
                MemoryAllocation memAlloc = TrashMem.AllocateMemory(bytes.Length + 1);
                if (memAlloc == null)
                {
                    return;
                }

                TrashMem.WriteBytes(memAlloc.Address, bytes);

                if (memAlloc.Address == 0)
                {
                    return;
                }

                string[] asm = new string[]
                {
                    $"MOV EAX, 0x{memAlloc.Address.ToString("X")}",
                    "PUSH 0",
                    "PUSH EAX",
                    "PUSH EAX",
                    $"CALL 0x{OffsetList.FunctionLuaDoString.ToString("X")}",
                    "ADD ESP, 0xC",
                    "RETN",
                };

                InjectAndExecute(asm, false);
                TrashMem.FreeMemory(memAlloc);
            }
        }
Exemplo n.º 4
0
        private void ButtonFreeAlloc_Click(object sender, RoutedEventArgs e)
        {
            if (TrashMem != null)
            {
                if (listboxAllocations.SelectedItem != null)
                {
                    TrashMem.FreeMemory((MemoryAllocation)listboxAllocations.SelectedItem);
                }

                UpdateAllocationsAndThreads();

                labelInt16.Content  = "n/a";
                labelInt32.Content  = "n/a";
                labelInt64.Content  = "n/a";
                labelFloat.Content  = "n/a";
                labelDouble.Content = "n/a";
            }
        }