private void HandleLogin(TrashMem trashMem, Process process, WowAccount wowAccount)
        {
            AmeisenBotLogger.Instance.Log($"[{process.Id.ToString("X" , CultureInfo.InvariantCulture.NumberFormat)}]\tHandling Login into account: {wowAccount.Username}:{wowAccount.CharacterName}:{wowAccount.CharacterSlot}", LogLevel.Verbose);
            foreach (char c in wowAccount.Username)
            {
                SendKeyToProcess(process, c, char.IsUpper(c));
                Thread.Sleep(10);
            }

            Thread.Sleep(100);
            SendKeyToProcess(process, 0x09);
            Thread.Sleep(100);

            bool firstTime = true;

            do
            {
                if (!firstTime)
                {
                    SendKeyToProcess(process, 0x0D);
                }

                foreach (char c in wowAccount.Password)
                {
                    SendKeyToProcess(process, c, char.IsUpper(c));
                    Thread.Sleep(10);
                }

                Thread.Sleep(500);
                SendKeyToProcess(process, 0x0D);
                Thread.Sleep(3000);

                firstTime = false;
            } while (trashMem.ReadString(OffsetList.StaticGameState, Encoding.ASCII, 10) == "login");
        }
 private string ReadString(uint offset, int lenght)
 {
     try
     {
         return(TrashMem.ReadString(offset, Encoding.ASCII, lenght));
     }
     catch { CheckForGameCrashed(); return(""); }
 }
Exemplo n.º 3
0
        public static List <WowProcess> GetRunningWows(IOffsetList offsetList)
        {
            List <WowProcess> wows        = new List <WowProcess>();
            List <Process>    processList = new List <Process>(Process.GetProcessesByName("Wow"));

            foreach (Process p in processList)
            {
                TrashMem trashMem = new TrashMem(p);
                uint     pDevice  = trashMem.ReadUnmanaged <uint>(offsetList.StaticEndSceneDevice);
                uint     pEnd     = trashMem.ReadUnmanaged <uint>(pDevice + offsetList.EndSceneOffsetDevice);
                uint     pScene   = trashMem.ReadUnmanaged <uint>(pEnd);
                uint     endscene = trashMem.ReadUnmanaged <uint>(pScene + offsetList.EndSceneOffset);

                bool isAlreadyHooked = false;
                try
                {
                    isAlreadyHooked = trashMem.ReadChar(endscene + 0x2) == 0xE9;
                }
                catch { }

                string name = trashMem.ReadString(offsetList.StaticPlayerName, Encoding.ASCII, 12);
                if (name.Length == 0)
                {
                    name = "";
                }

                string realm = trashMem.ReadString(offsetList.StaticRealmName, Encoding.ASCII, 12);
                if (realm.Length == 0)
                {
                    realm = "";
                }

                wows.Add(new WowProcess(p, name, realm, isAlreadyHooked));
                trashMem.Detach();
            }

            return(wows);
        }
        public bool DoLogin(Process process, WowAccount wowAccount, IOffsetList offsetlist, int maxTries = 4)
        {
            try
            {
                TrashMem trashMem = new TrashMem(process);
                int      count    = 0;

                LoginInProgress = true;
                LoginInProgressCharactername = wowAccount.CharacterName;

                OffsetList = offsetlist;

                while (trashMem.ReadInt32(offsetlist.StaticIsWorldLoaded) != 1)
                {
                    if (process.HasExited || count >= maxTries)
                    {
                        return(false);
                    }

                    switch (trashMem.ReadString(offsetlist.StaticGameState, Encoding.ASCII, 10))
                    {
                    case "login":
                        HandleLogin(trashMem, process, wowAccount);
                        count++;
                        break;

                    case "charselect":
                        HandleCharSelect(trashMem, process, wowAccount);
                        break;

                    default:
                        count++;
                        break;
                    }

                    Thread.Sleep(2000);
                }
            }
            catch (Exception e)
            {
                AmeisenBotLogger.Instance.Log($"[{process.Id.ToString("X" , CultureInfo.InvariantCulture.NumberFormat)}]\tCrash at Login: \n{e}", LogLevel.Error);
                return(false);
            }

            AmeisenBotLogger.Instance.Log($"[{process.Id.ToString("X" , CultureInfo.InvariantCulture.NumberFormat)}]\tLogin successful...", LogLevel.Verbose);
            LoginInProgress = false;
            LoginInProgressCharactername = string.Empty;

            return(true);
        }
Exemplo n.º 5
0
        private static void Main(string[] args)
        {
            Console.Title = "TrashMem Benchmark";
            Process[] testProcesses = Process.GetProcessesByName("ShittyMcUlow");

            if (testProcesses.Length > 0)
            {
                TrashMem TrashMem = new TrashMem(testProcesses.ToList().First());

                Console.WriteLine($"TrashMem Benchmark doing {TOTAL_RUNS} runs for every function");
                Console.WriteLine($">> 1 Byte Char");
                PrettyPrintValue("Read<char>", BenchmarkFunction(() => TrashMem.ReadUnmanaged <char>(STATIC_ADDRESS_INT16)));
                PrettyPrintValue("ReadChar", BenchmarkFunction(() => TrashMem.ReadChar(STATIC_ADDRESS_INT16)));
                PrettyPrintValue("ReadCharSafe", BenchmarkFunction(() => TrashMem.ReadCharSafe(STATIC_ADDRESS_INT16)));
                Console.WriteLine($">> 2 Byte Short");
                PrettyPrintValue("Read<short>", BenchmarkFunction(() => TrashMem.ReadUnmanaged <short>(STATIC_ADDRESS_INT16)));
                PrettyPrintValue("ReadInt16", BenchmarkFunction(() => TrashMem.ReadInt16(STATIC_ADDRESS_INT16)));
                PrettyPrintValue("ReadInt16Safe", BenchmarkFunction(() => TrashMem.ReadInt16Safe(STATIC_ADDRESS_INT16)));
                Console.WriteLine($">> 4 Byte Integer");
                PrettyPrintValue("Read<int>", BenchmarkFunction(() => TrashMem.ReadUnmanaged <int>(STATIC_ADDRESS_INT32)));
                PrettyPrintValue("ReadInt32", BenchmarkFunction(() => TrashMem.ReadInt32(STATIC_ADDRESS_INT32)));
                PrettyPrintValue("ReadInt32Safe", BenchmarkFunction(() => TrashMem.ReadInt32Safe(STATIC_ADDRESS_INT32)));
                Console.WriteLine($">> 8 Byte Long");
                PrettyPrintValue("Read<long>", BenchmarkFunction(() => TrashMem.ReadUnmanaged <long>(STATIC_ADDRESS_INT64)));
                PrettyPrintValue("ReadInt64", BenchmarkFunction(() => TrashMem.ReadInt64(STATIC_ADDRESS_INT64)));
                PrettyPrintValue("ReadInt64Safe", BenchmarkFunction(() => TrashMem.ReadInt64Safe(STATIC_ADDRESS_INT64)));
                Console.WriteLine($">> 12 Byte String");
                PrettyPrintValue("ReadString", BenchmarkFunction(() => TrashMem.ReadString(STATIC_ADDRESS_STRING, Encoding.ASCII, 12)));
                Console.WriteLine($">> 16 Byte Struct");
                PrettyPrintValue("ReadStruct<TestStruct>", BenchmarkFunction(() => TrashMem.ReadStruct <TestStruct>(STATIC_ADDRESS_INT16)));
            }
            else
            {
                Console.WriteLine("Error: please make sure a ShittyMcUlow process is running...");
            }

            Console.ReadLine();
        }
Exemplo n.º 6
0
 public void ReadString()
 => Assert.AreEqual("ShittyMcUlow", TrashMem.ReadString(STATIC_ADDRESS_STRING, Encoding.ASCII, 12));