Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.75 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Linq;
  5. using System.Text;
  6. using iHook;
  7.  
  8. namespace Relogger
  9. {
  10.     class Program
  11.     {
  12.        
  13.         public static uint Direct3D9__Device = 0x98BCDC;
  14.         public static uint Direct3D9__Device__OffsetA = 0x27C4;
  15.         public static uint Direct3D9__Device__OffsetB = 0xA8;
  16.         public static uint ClntObjMgrGetActivePlayerObjAddress = 0x3520;
  17.         public static uint Lua_DoStringAddress = 0x3A2620;
  18.         public static uint Lua_GetLocalizedTextAddress = 0x1C2250;
  19.  
  20.         public static string username = "@gmail.com";
  21.         public static string password = "pw";
  22.         public static string accname = "acct"; // has to be caps?
  23.         public static string name = "charname"; // has to have first capital letter
  24.         public static string realm = "realm"; // has to have first capital letter
  25.  
  26.         public static string hbuser = "test";
  27.         public static string hbpass = "test";
  28.  
  29.         bool HBRunning = false;
  30.         bool WoWRunning = false;
  31.  
  32.         Process[] processes;
  33.         Process honorbuddy;
  34.         Process wow;
  35.  
  36.         bool reloggerrunning = false;
  37.  
  38.         static void Main(string[] args)
  39.         {
  40.  
  41.             Console.WriteLine("Ghetto Relogger!");
  42.  
  43.             Program relogger = new Program();
  44.             relogger.reloggerrunning = true;
  45.  
  46.             while (relogger.reloggerrunning)
  47.             {
  48.  
  49.                 if (!relogger.CheckRunningWoW() || !relogger.CheckRunningHB())
  50.                 {
  51.                     try
  52.                     {
  53.                         relogger.wow.Kill();
  54.                         relogger.wow = null;
  55.                         relogger.honorbuddy.Kill();
  56.                         relogger.honorbuddy = null;
  57.                     }
  58.                     catch { }
  59.  
  60.                     relogger.StartAll();
  61.                 }
  62.                    
  63.             }
  64.         }
  65.  
  66.  
  67.         internal static uint GetEndscene()
  68.         {
  69.             uint D3D9_Device;
  70.             D3D9_Device = Memory.Read<uint>(Memory.BaseAddress + Direct3D9__Device);
  71.             D3D9_Device = Memory.Read<uint>(D3D9_Device + Direct3D9__Device__OffsetA);
  72.             D3D9_Device = Memory.Read<uint>(D3D9_Device);
  73.             D3D9_Device = Memory.Read<uint>(D3D9_Device + Direct3D9__Device__OffsetB);
  74.  
  75.             return D3D9_Device;
  76.         }
  77.  
  78.         void StartAll()
  79.         {
  80.             StartWoW(10000);
  81.             HookWoW();
  82.             System.Threading.Thread.Sleep(1000);
  83.             LoginWoW();
  84.             StartHB(10000);
  85.         }
  86.  
  87.         bool CheckRunningWoW()
  88.         {
  89.             if (wow != null)
  90.                 if (wow.Responding)
  91.                     return true;
  92.                 else
  93.                     return false;
  94.             else
  95.                 return false;
  96.         }
  97.  
  98.         bool CheckRunningHB()
  99.         {
  100.             if (honorbuddy != null)
  101.                 if (honorbuddy.Responding)
  102.                     return true;
  103.                 else
  104.                     return false;
  105.             else
  106.                 return false;
  107.         }
  108.  
  109.         void StartWoW(int sleepTime)
  110.         {
  111.             Console.WriteLine("Starting WoW and delaying for " + sleepTime/1000 + " seconds");
  112.    
  113.             wow = new Process();
  114.  
  115.             wow.StartInfo.FileName = "C:\\Program Files (x86)\\World of Warcraft\\wow.exe";
  116.             wow.Start();
  117.  
  118.             WoWRunning = true;
  119.             System.Threading.Thread.Sleep(sleepTime);
  120.         }
  121.  
  122.         void StartHB(int sleepTime) // start HB after sleepTime in ms
  123.         {
  124.             Console.WriteLine("Starting HB in " + sleepTime/1000 + " seconds");
  125.             System.Threading.Thread.Sleep(sleepTime);
  126.             honorbuddy = new Process();
  127.  
  128.             honorbuddy.StartInfo.FileName = "C:\\Users\\Scott\\Desktop\\Honorbuddy_2.0.0.4129\\Honorbuddy.exe";
  129.             honorbuddy.StartInfo.Arguments = "/autostart /pid=" + wow.Id + " /hbuser=" + hbuser + " /hbpass=" + hbpass;
  130.  
  131.             honorbuddy.Start();
  132.             HBRunning = true;
  133.         }
  134.  
  135.         void LoginWoW()
  136.         {
  137.             Hook.DoString(login);
  138.             System.Threading.Thread.Sleep(5000);
  139.             Hook.DoString(login);
  140.             System.Threading.Thread.Sleep(5000);
  141.             Hook.DoString(login);
  142.             System.Threading.Thread.Sleep(5000);
  143.             Hook.DoString(login);
  144.         }
  145.  
  146.         void HookWoW()
  147.         { /*
  148.             Console.WriteLine("Finding WoW");
  149.             processes = Process.GetProcessesByName("Wow");
  150.  
  151.             if (processes.Length < 0)
  152.             {
  153.                 Console.WriteLine("WoW not found.");
  154.                 Console.ReadLine();
  155.             }
  156.             else
  157.             {
  158.                 Console.WriteLine("WoW process: " + wow.Id + " found!");
  159.             */
  160.                 Console.WriteLine("Attaching...");
  161.  
  162.                 if (Memory.OpenProcess(wow.Id))
  163.                 {
  164.                     Hook.Apply(GetEndscene(), ClntObjMgrGetActivePlayerObjAddress, Lua_DoStringAddress, Lua_GetLocalizedTextAddress);
  165.                 }
  166.             //}
  167.  
  168.         }
  169.  
  170.         string login = "if (WoWAccountSelectDialog and WoWAccountSelectDialog:IsShown()) then " +
  171.                 "for i = 0, GetNumGameAccounts() do " +
  172.                     "if GetGameAccountInfo(i) == '" + accname + "' then " +
  173.                         "WoWAccountSelect_SelectAccount(i) " +
  174.                     "end " +
  175.                 "end " +
  176.             "elseif (AccountLoginUI and AccountLoginUI:IsVisible()) then " +
  177.                 "DefaultServerLogin('" + username + "', '" + password + "') " +
  178.                 "AccountLoginUI:Hide() " +
  179.             "elseif (RealmList and RealmList:IsVisible()) then " +
  180.                 "for i = 1, select('#',GetRealmCategories()) do " +
  181.                     "for j = 1, GetNumRealms(i) do " +
  182.                         "if GetRealmInfo(i, j) == '" + realm + "' then " +
  183.                             "RealmList:Hide() " +
  184.                             "ChangeRealm(i, j) " +
  185.                         "end " +
  186.                     "end " +
  187.                 "end " +
  188.             "elseif (CharacterSelectUI and CharacterSelectUI:IsVisible()) then " +
  189.                 "if GetServerName() ~= '" + realm + "' and (not RealmList or not RealmList:IsVisible()) then " +
  190.                     "RequestRealmList(1) " +
  191.                 "else " +
  192.                     "for i = 0,GetNumCharacters() do " +
  193.                         "if (GetCharacterInfo(i) == '" + name + "') then " +
  194.                             "CharacterSelect_SelectCharacter(i) " +
  195.                             "EnterWorld() " +
  196.                         "end " +
  197.                     "end " +
  198.                 "end " +
  199.             "end ";
  200.  
  201.     }
  202. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement