public void InitMemory() { try { wow = new BlackMagic(); //Create new function to open wow process if (PId == 0) { wow.OpenProcessAndThread(SProcess.GetProcessFromWindowTitle("World of Warcraft")); } else { wow.OpenProcessAndThread(PId); } if (wow.ProcessId != 0) { WowControl.hWnd = (uint)wow.WindowHandle; GoTo(0, 0, 0, 0, 0); } else { playerbase = 0; BgStatus = 0; IsIndoors = 0; IsMounted = 0; BattlefieldInstanceExpiration = 0; Location = ""; SubLocation = ""; LastError = ""; Speed = 0;; X = 0; Y = 0; Z = 0; LastRead = new DateTime(); PlayerForm = 0; Objects = new List <ObjectInfo>(); PlayerBuffs = new List <AURA>(); } } catch (Exception) { } }
public bool tryAttach(int dwProcessId) { try { //Lets Open wow for manipulation tempMem.OpenProcessAndThread(dwProcessId); //Lets find the Pattern - Shynd dwCodeLoc = SPattern.FindPattern(tempMem.ProcessHandle, tempMem.MainModule, PatternClientConnection, MaskClientConnection, ' '); //Lets find the s_curMgr g_clientConnection = tempMem.ReadUInt(dwCodeLoc + 0x16); clientConnection = tempMem.ReadUInt(g_clientConnection); curMgrOffset = tempMem.ReadUInt(dwCodeLoc + 0x1C); //Lets find the CurMgr Offset curMgr = tempMem.ReadUInt(clientConnection + curMgrOffset); //clientConnection + CurMgrOffest = Win getDescriptors = new Descriptors(tempMem); localPlayerObject = getObjectByGUID(tempMem.ReadUInt64(curMgr + LocalGuidOffset)); if (XP != -10) { return(true); } } catch { return(false); } return(false); }
static void Main(string[] args) { uint dwCodeLoc; wow = new BlackMagic(); if (wow.OpenProcessAndThread(SProcess.GetProcessFromProcessName("wow"))) { Console.WriteLine(wow.GetModuleFilePath()); DateTime dt = DateTime.Now; //dwCodeLoc = SPattern.FindPattern(wow.ProcessHandle, wow.MainModule, PATTERN_CLIENT_CONNECTION, MASK_CLIENT_CONNECTION, ' '); dwCodeLoc = wow.FindPattern(PATTERN_CLIENT_CONNECTION, MASK_CLIENT_CONNECTION); Console.WriteLine("Pattern found in {0}ms", DateTime.Now.Subtract(dt).TotalMilliseconds); Console.WriteLine("Code loc: 0x{0:X08}", dwCodeLoc); Console.WriteLine("CLIENT_CONNECTION: 0x{0:X08}", wow.ReadUInt(dwCodeLoc + 0x16)); Console.WriteLine("CURMGR_OFFSET: 0x{0:X08}", wow.ReadUInt(dwCodeLoc + 0x1C)); } else { Console.WriteLine("World of Warcraft could not be opened for read/write."); } Console.ReadLine(); }
private void button1_Click(object sender, EventArgs e) { magic = new BlackMagic(); if (magic.OpenProcessAndThread(SProcess.GetProcessFromProcessName("WoW"))) { handle = FindWindow(null, "World of Warcraft"); attachLabel.Text = "Attached to WoW"; if (profileLoaded && spellsLoaded) { startButton.Show(); start = 3; } attached = true; menuButton3.Show(); newProfile = new CreateProfile(magic, pointsTextBox); // //check this profileThread = new Thread(newProfile.DoWork); profileThread.Start(); sendMsgBox.Show(); sendMsgButton.Show(); sayLabel.Show(); whisperLabel.Show(); replyLabel.Show(); partyLabel.Show(); guildLabel.Show(); //testLabel.Text = magic.ReadShort((uint)TbcOffsets.General.Cursor)+""; } else { attachLabel.Text = "World of Warcraft does not appear to be running"; } }
static void Main(string[] args) { //Open the proccess wow = new BlackMagic(); wow.OpenProcessAndThread(SProcess.GetProcessFromWindowTitle(PROCESS_WINDOW_TITLE)); //Setup Object Manager and First object base address ObjMgrAddr = wow.ReadUInt(wow.ReadUInt((uint)wow.MainModule.BaseAddress + (uint)Constants.Const.ObjectManager.CurMgrPointer) + (uint)Constants.Const.ObjectManager.CurMgrOffset); FirstObject = new GameObject(wow.ReadUInt(ObjMgrAddr + (uint)Constants.Const.ObjectManager.FirstObject)); //Read TargetGUID from globals and find in the Object Manager //UInt64 CurrTargetGUID = wow.ReadUInt64((uint)wow.MainModule.BaseAddress + (uint)Const.Globals.CurrentTargetGUID); UInt64 CurrTargetGUID = wow.ReadUInt64((uint)wow.MainModule.BaseAddress + (uint)Constants.Const.Globals.CurrentTargetGUID); PlayerObject = new GameObject(wow.ReadUInt64((uint)wow.MainModule.BaseAddress + (uint)Constants.Const.Globals.PlayerGUID)); TargetObject = new GameObject(CurrTargetGUID); PlayerObject.Wowclass = wow.ReadByte(PlayerObject.DescriptorArrayAddress + (uint)Const.descriptors.Class8); System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Interval = 100; if (PlayerObject.Wowclass == 9) { Console.WriteLine("Initiate Affliction Warlock DPS BOT v1.0"); aTimer.Elapsed += WarlockDPS.DpsEvent; } else if (PlayerObject.Wowclass == 11) { Console.WriteLine("Initiate Feral Druid DPS BOT v0.1"); aTimer.Elapsed += DruidDPS.DpsEvent; } aTimer.AutoReset = true; aTimer.Enabled = true; while (true) { switch (Console.ReadLine()) { case "stop": Console.WriteLine("STOP"); aTimer.Elapsed -= DruidDPS.DpsEvent; aTimer.Elapsed -= WarlockDPS.DpsEvent; aTimer.Elapsed -= PrinterEvent; break; case "printer": aTimer.Elapsed += PrinterEvent; break; case "start": if (PlayerObject.Wowclass == 9) { Console.WriteLine("Initiate Affliction Warlock DPS BOT v1.0"); aTimer.Elapsed += WarlockDPS.DpsEvent; } else if (PlayerObject.Wowclass == 11) { Console.WriteLine("Initiate Feral Druid DPS BOT v0.1"); aTimer.Elapsed += DruidDPS.DpsEvent; } break; } } }
//finzonetest public ManageMem() { if (WowReader.OpenProcessAndThread(SProcess.GetProcessFromProcessName("Wow"))) { Console.WriteLine("Found and Attached the World of Warcraft Process!"); if (LoadAddresses()) { Console.WriteLine("ok"); } } else { Console.WriteLine("Process not found"); } }
private void bUpdateRenderState_Click(object sender, EventArgs e) { for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (ProcessExists(Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value))) { wow.OpenProcessAndThread(Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value)); if ((bool)dataGridView1.Rows[i].Cells[0].Value) { wow.WriteUInt(0x00C7B2A4, 0); } else { wow.WriteUInt(0x00C7B2A4, 0x0F110B73); } } } }
public MemoryFunctions(int ProcessIdOfWoW) { this.ProcessIdOfWoW = ProcessIdOfWoW; //Lets Open wow for manipulation Memory.OpenProcessAndThread(ProcessIdOfWoW); //Lets find the Pattern - Shynd dwCodeLoc = SPattern.FindPattern(Memory.ProcessHandle, Memory.MainModule, PatternClientConnection, MaskClientConnection, ' '); //Lets find the s_curMgr try { g_clientConnection = Memory.ReadUInt(dwCodeLoc + 0x16); clientConnection = Memory.ReadUInt(g_clientConnection); curMgrOffset = Memory.ReadUInt(dwCodeLoc + 0x1C); //Lets find the CurMgr Offset curMgr = Memory.ReadUInt(clientConnection + curMgrOffset); //clientConnection + CurMgrOffest = Win } catch { } }
static void Main(string[] args) { BlackMagic wow = new BlackMagic(); Console.WriteLine("Let the window remain open as long as you dont want to be flagged as AFK"); while (true) { Process[] p = Process.GetProcessesByName("WoW"); foreach (Process x in p) { wow.OpenProcessAndThread(x.Id); string version = wow.ReadASCIIString(0x00837C04, 6); if (version == "1.12.1") { wow.WriteInt(0x00CF0BC8, Environment.TickCount); } } System.Threading.Thread.Sleep(10000); } }
public GObjectList(int ProcessIdOfWoW) { bool didit = false; this.ProcessIdOfWoW = ProcessIdOfWoW; while (didit == false) { Memory = new BlackMagic(); //this.form = form; //Lets Open wow for manipulation Memory.OpenProcessAndThread(ProcessIdOfWoW); //Lets find the Pattern - Shynd dwCodeLoc = SPattern.FindPattern(Memory.ProcessHandle, Memory.MainModule, PatternClientConnection, MaskClientConnection, ' '); //Lets find the s_curMgr try { g_clientConnection = Memory.ReadUInt(dwCodeLoc + 0x16); clientConnection = Memory.ReadUInt(g_clientConnection); curMgrOffset = Memory.ReadUInt(dwCodeLoc + 0x1C); //Lets find the CurMgr Offset curMgr = Memory.ReadUInt(clientConnection + curMgrOffset); //clientConnection + CurMgrOffest = Win LocalGUIDVariable = Memory.ReadUInt64(curMgr + LocalGuidOffset); localPlayerObject = getObjectByGUID(LocalGUIDVariable); localPlayer = new GPlayerSelf(this, localPlayerObject); } catch { } Descriptor = new Descriptors(Memory); //Lets start the object refresher objectRefresher = new Refresher(ProcessIdOfWoW); objectRefresher.GameObjectCreated += new EventHandler <GameObjectEventArgs>(addToLists); objectRefresher.GameObjectReleased += new EventHandler <GameObjectEventArgs>(removeFromLists); didit = true; } }
public void Hooking() { // Process Connect: if (!Memory.IsProcessOpen) { Memory.OpenProcessAndThread(processId); } if (Memory.IsProcessOpen) { txtDebug.Text += "VirtualAlloc Hook: " + vaHookPtr.ToString("X") + " | " + Memory.ReadByte(vaHookPtr).ToString("X") + "\r\n"; if (Memory.ReadByte(vaHookPtr) == 0xE9 && (injected_code == 0 || eaxStore == 0)) // check if wow is already hooked and dispose Hook { DisposeHooking(); } if (Memory.ReadByte(vaHookPtr) != 0xE9) // check if wow is already hooked { try { threadHooked = false; // allocate memory to store injected code: (Das ist die codecave wohin die Endscene umgeleitet wird) injected_code = Memory.AllocateMemory(2048); txtDebug.Text += "injected_code: " + injected_code.ToString("X") + "\r\n"; // die Adresse in welche EAX hingespeichert wird eaxStore = Memory.AllocateMemory(0x4); txtDebug.Text += "eaxStore: " + eaxStore.ToString("X") + "\r\n"; // allocate memory the pointer return value: retnInjectionAsm = Memory.AllocateMemory(0x4); txtDebug.Text += "retnInjectionAsm: " + retnInjectionAsm.ToString("X") + "\r\n"; Memory.WriteInt(retnInjectionAsm, 0); // Generate the STUB to be injected Memory.Asm.Clear(); // $Asm // save regs //Memory.Asm.AddLine("pushad"); //Memory.Asm.AddLine("pushfd"); Memory.Asm.AddLine("mov [" + eaxStore + "],eax"); // Size asm jumpback int sizeJumpBack = 5; Memory.Asm.AddLine("jmp " + (vaHookPtr + sizeJumpBack)); // inject code in codecave uint sizeAsm = (uint)(Memory.Asm.Assemble().Length); Memory.Asm.Inject(injected_code); txtDebug.Text += "Injecting ...\r\n"; // create hook jump Memory.Asm.Clear(); // $jmpto Memory.Asm.AddLine("jmp " + (injected_code)); Memory.Asm.AddLine("retn 10h"); Memory.Asm.Inject(vaHookPtr); } catch { threadHooked = false; return; } } threadHooked = true; } }
public static Structs.PatternList FindPatternList(Structs.PatternList patternList) { Structs.PatternList newPatternList = new Structs.PatternList(); newPatternList.processName = patternList.processName; uint baseModule = 0; BlackMagic memread = new BlackMagic(); if (memread.OpenProcessAndThread(SProcess.GetProcessFromProcessName(patternList.processName))) { try { // Dump module ProcessModuleCollection modules = Process.GetProcessById(memread.ProcessId).Modules; foreach (ProcessModule o in modules) { Structs.ModuleList m = new Structs.ModuleList(); m.Name = o.ModuleName; m.baseAddressDec = (int)o.BaseAddress; m.baseAddressHex = (o.BaseAddress).ToString("X"); patternList.Modules.Add(m); // Check module base if exist. if (patternList.baseModuleName != "") { if (patternList.baseModuleName.ToLower() == o.ModuleName.ToLower()) { baseModule = (uint)o.BaseAddress; } } } } catch { } foreach (Structs.Pattern p in patternList.Patterns) { try { uint dwCodeLoc = memread.FindPattern(p.pattern, p.mask); uint offset = memread.ReadUInt((uint)((int)dwCodeLoc + p.offsetLocation)); if (offset > 0) { offset = offset - baseModule; dwCodeLoc = dwCodeLoc - baseModule; } if (offset > 0) { // Dump offset p.offset = offset.ToString("X"); p.offsetDec = offset; p.offsetUsedAtDec = (uint)((int)dwCodeLoc + p.offsetLocation); p.offsetUsedAt = ((int)dwCodeLoc + p.offsetLocation).ToString("X"); try { switch (p.type) { case "int64": p.value = Convert.ToString(memread.ReadUInt64(p.offsetDec)); break; case "int": p.value = Convert.ToString(memread.ReadInt(p.offsetDec)); break; case "float": p.value = Convert.ToString(memread.ReadFloat(p.offsetDec)); break; case "string": p.value = Convert.ToString(memread.ReadASCIIString(p.offsetDec, 30)); break; } } catch { p.value = "No Found"; } } else { p.offset = "No Found"; } } catch { p.offset = "No Found"; } newPatternList.Patterns.Add(p); } memread.Close(); } else { MessageBox.Show("Process no found."); } return(patternList); }
private void bCreatePattern_Click(object sender, EventArgs e) { if (cbProcess1.Text.Replace(" ", "") != "" && cbProcess2.Text.Replace(" ", "") != "" && tbOffset1.Text.Replace(" ", "").Replace("0x", "") != "" && tbOffset2.Text.Replace(" ", "").Replace("0x", "") != "") { string[] process1Array = cbProcess1.Text.Replace(" ", "").Split(Convert.ToChar("-")); string[] process2Array = cbProcess2.Text.Replace(" ", "").Split(Convert.ToChar("-")); if (process1Array != null && process2Array != null) { if (process1Array.Length > 0 && process2Array.Length > 0) { try { // Process choose to ID int process1Id = Convert.ToInt32(process1Array[0]); int process2Id = Convert.ToInt32(process2Array[0]); // Open Process BlackMagic process1BM = new BlackMagic(); BlackMagic process2BM = new BlackMagic(); if (!process1BM.OpenProcessAndThread(process1Id)) { MessageBox.Show("Open Process 1 failled."); return; } if (!process2BM.OpenProcessAndThread(process2Id)) { MessageBox.Show("Open Process 2 failled."); return; } // Get Module uint moduleBase1BM = 0; uint moduleBase2BM = 0; string moduleShow = ""; if (baseModuleNameTB.Text != "") { moduleBase1BM = (uint)process1BM.GetModule(baseModuleNameTB.Text).BaseAddress; moduleBase2BM = (uint)process2BM.GetModule(baseModuleNameTB.Text).BaseAddress; moduleShow = baseModuleNameTB.Text + " + "; if (moduleBase1BM <= 0 || moduleBase2BM <= 0) { MessageBox.Show("Module not found."); return; } } // Offset choose to uint uint offset1 = uint.Parse(tbOffset1.Text.Replace(" ", "").Replace("0x", ""), System.Globalization.NumberStyles.HexNumber) + moduleBase1BM; uint offset2 = uint.Parse(tbOffset2.Text.Replace(" ", "").Replace("0x", ""), System.Globalization.NumberStyles.HexNumber) + moduleBase2BM; // Offset to 4 Byte string tPattern1 = offset1.ToString("X"); while (tPattern1.Length < 8) { tPattern1 = "0" + tPattern1; } string tPattern2 = offset2.ToString("X"); while (tPattern2.Length < 8) { tPattern2 = "0" + tPattern2; } // Offset 4 byte inverse string t2Pattern1 = tPattern1.Substring(6, 2); t2Pattern1 += " " + tPattern1.Substring(4, 2); t2Pattern1 += " " + tPattern1.Substring(2, 2); t2Pattern1 += " " + tPattern1.Substring(0, 2); string t2Pattern2 = tPattern2.Substring(6, 2); t2Pattern2 += " " + tPattern2.Substring(4, 2); t2Pattern2 += " " + tPattern2.Substring(2, 2); t2Pattern2 += " " + tPattern2.Substring(0, 2); // Find offset used at string tMask = "xxxx"; uint dwCodeLoc1 = process1BM.FindPattern(t2Pattern1, tMask); uint dwCodeLoc2 = process2BM.FindPattern(t2Pattern2, tMask); if (dwCodeLoc1 <= 0 || dwCodeLoc2 <= 0) { MessageBox.Show("Offset not found."); return; } // Read Pattern byte[] bytesPorcess1 = process1BM.ReadBytes(dwCodeLoc1, 16); byte[] bytesPorcess2 = process2BM.ReadBytes(dwCodeLoc2, 16); // Make mask string mask = ""; for (int i = 0; i <= bytesPorcess1.Length - 1; i++) { if (bytesPorcess1[i] == bytesPorcess2[i] && i > 3) { mask += "x"; } else { bytesPorcess1[i] = 0; bytesPorcess2[i] = 0; mask += "?"; } } // Pattern to String string pattern = BitConverter.ToString(bytesPorcess1); pattern = pattern.Replace("-", " "); // Show Result tbPattern.Text = ""; tbPattern.Text += "Offset 1 used at: " + moduleShow + "0x" + (dwCodeLoc1 - moduleBase1BM).ToString("x") + Environment.NewLine; tbPattern.Text += "Offset 2 used at: " + moduleShow + "0x" + (dwCodeLoc2 - moduleBase2BM).ToString("x") + Environment.NewLine + Environment.NewLine; tbPattern.Text += "<Pattern>" + Environment.NewLine; tbPattern.Text += " <offsetName>" + tbOffsetName.Text + "</offsetName>" + Environment.NewLine; tbPattern.Text += " <pattern>" + pattern + "</pattern>" + Environment.NewLine; tbPattern.Text += " <mask>" + mask + "</mask>" + Environment.NewLine; tbPattern.Text += " <offsetLocation>0</offsetLocation>" + Environment.NewLine; tbPattern.Text += " <type>" + cbValueType.Text + "</type>" + Environment.NewLine; tbPattern.Text += "</Pattern>"; process1BM.Close(); process2BM.Close(); } catch { MessageBox.Show("Error, please verif all info."); } } else { MessageBox.Show("Please select Process."); } } else { MessageBox.Show("Please select Process."); } } else { MessageBox.Show("Please enter all information."); } }
private static void AfterProcessStart() { Debug("char", "Executing AfterStart ..."); if (WoWProcessStarted != null) { WoWProcessStarted(process.Id); } try { // Set before using any BlackMagic methods process.EnableRaisingEvents = true; process.Exited += exitProcess; IntPtr hnd = process.MainWindowHandle; WowHWND = AppHelper.WaitForWowWindow((uint)process.Id); CommandManager.WowHWND = WowHWND; //verify we haven't already opened it, like when we do the injection if (!wowProcess.IsProcessOpen) { wowProcess.OpenProcessAndThread(process.Id); } // We don't let anyone do anything until wow has finished launching // We look for the TLS first ProcessStatus = ProcessStatuses.WOW_LOOK_FOR_TLS; while (!FindTLS()) { Debug("char", "Looking for the TLS ..."); Thread.Sleep(250); } if (config.WowPos != null) { BabBot.Common.WindowSize.SetPositionSize((IntPtr)WowHWND, config.WowPos.Pos.X, config.WowPos.Pos.Y, config.WowPos.Pos.Width, config.WowPos.Pos.Height); } else if (config.WoWInfo.Resize) { BabBot.Common.WindowSize.SetPositionSize( (IntPtr)WowHWND, 0, 0, 328, 274); } // At this point it should be safe to do any LUA calls if (WoWGameLoaded != null) { WoWGameLoaded(); } ProcessStatus = ProcessStatuses.WOW_RUNNING; GameStatus = GameStatuses.INIT; Debug("char", "AfterStart completed."); } catch (Exception e) { if (WoWProcessAccessFailed != null) { WoWProcessAccessFailed(e.Message); } } }
private void button2_Click(object sender, EventArgs e) { if (Utils.IsUserAdministrator()) { Utils.SYSTEM_INFO sys_info = new Utils.SYSTEM_INFO(); Utils.GetSystemInfo(out sys_info); IntPtr proc_min_address = sys_info.minimumApplicationAddress; IntPtr proc_max_address = sys_info.maximumApplicationAddress; long proc_min_address_l = (long)proc_min_address; long proc_max_address_l = (long)proc_max_address; logDebug(String.Format("Min {0} Max {1}", proc_min_address_l, proc_max_address_l)); BlackMagic bm = new BlackMagic(); if (bm.OpenProcessAndThread(SProcess.GetProcessFromProcessName(windowName[0]))) { logDebug("Found"); Utils.MEMORY_BASIC_INFORMATION mem_basic_info = new Utils.MEMORY_BASIC_INFORMATION(); while (proc_min_address_l < proc_max_address_l) { // 28 = sizeof(MEMORY_BASIC_INFORMATION) Utils.VirtualQueryEx(bm.ProcessHandle, proc_min_address, out mem_basic_info, 28); //logDebug(mem_basic_info.ToString()); // if this memory chunk is accessible if ((mem_basic_info.Protect == Utils.PAGE_READWRITE || mem_basic_info.Protect == Utils.PAGE_READONLY) && mem_basic_info.State == Utils.MEM_COMMIT) { //logDebug(String.Format("Addr={0:X8} Size={1}", mem_basic_info.BaseAddress, mem_basic_info.RegionSize)); byte[] buffer = new byte[mem_basic_info.RegionSize]; // read everything in the buffer above buffer = bm.ReadBytes((uint)mem_basic_info.BaseAddress, mem_basic_info.RegionSize); //Utils.ReadProcessMemory((int)bm.ProcessHandle, mem_basic_info.BaseAddress, buffer, mem_basic_info.RegionSize, ref bytesRead); MemoryStream ms = new MemoryStream(buffer); BinaryReader br = new BinaryReader(ms); while (ms.Position != ms.Length) { int data = br.ReadInt32(); if ((data == 18248) || (data == 18622)) { int readData = bm.ReadInt((uint)(mem_basic_info.BaseAddress + ms.Position - 4)); logDebug(String.Format("Found Addr={0:X8} Size={1}", mem_basic_info.BaseAddress + ms.Position - 4, readData)); } } // then output this in the file //for (int i = 0; i < mem_basic_info.RegionSize; i++) // sw.WriteLine("0x{0} : {1}", (mem_basic_info.BaseAddress + i).ToString("X"), (char)buffer[i]); } // move to the next memory chunk proc_min_address_l += mem_basic_info.RegionSize; proc_min_address = new IntPtr(proc_min_address_l); } bm.Close(); logDebug("Done"); } } else { logDebug("Need admin user"); } }