Пример #1
0
 /// <summary>
 /// Writes DragonNest TCP (XTEA) Key to TCPKey.txt
 ///     Use this function only when game is fully loaded. Will write null bytes if not.
 /// </summary>
 /// <returns>Returns a bool specifying whether or not the key retrieval was successful.</returns>
 public byte[] GetXTEAKey()
 {
     try
     {
         if (DNProcessHandle == IntPtr.Zero)
         {
             _Process        = Process.GetProcesses().First(x => x.ProcessName == "DragonNest");
             DNProcessHandle = _Process.Handle;
         }
         PatternFinder finder      = new PatternFinder(_Process, new IntPtr(0xC50000), 0x20000);
         IntPtr        virtualAddr = finder.FindPattern(new byte[] { 0x33, 0xD2, 0x85, 0xC0, 0x0F, 0x9D, 0xC2, 0x5F, 0x83, 0xEA, 0x01, 0x8B, 0xC2 }, "xxxxxxxxxxxxx", -58);
         finder.ResetRegion();
         if (virtualAddr == IntPtr.Zero)
         {
             return(new byte[0]);
         }
         var buf = new byte[0x06];
         ReadProcessMemory(DNProcessHandle, virtualAddr, buf, buf.Length, 0);
         var addr = new IntPtr(BitConverter.ToInt32(buf, 2));
         ReadProcessMemory(DNProcessHandle, addr, buf, 4, 0);
         addr = new IntPtr(BitConverter.ToInt32(buf, 0));
         var buffer = new byte[0x1005];
         ReadProcessMemory(DNProcessHandle, addr, buffer, buffer.Length, 0);
         var op = ReadProcessMemory(DNProcessHandle, addr, buffer, buffer.Length, 0);
         File.WriteAllText("TCPKey.txt", "0x" + buffer.Select(x => x.ToString("X2")).Aggregate((x, y) => x + ", 0x" + y));
         return(buffer);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message + ex.StackTrace);
         return(new byte[0]);
     }
 }
Пример #2
0
 /// <summary>
 /// Patches game IP check to allow for localhost or 127.0.0.1 usage.
 /// </summary>
 /// <returns>Returns a bool specifying if the patch completed succesfully.</returns>
 public bool PatchIPCheck()
 {
     try
     {
         if (DNProcessHandle == IntPtr.Zero)
         {
             _Process        = Process.GetProcesses().First(x => x.ProcessName == "DragonNest");
             DNProcessHandle = _Process.Handle;
         }
         var           patchBytes  = new byte[] { 0x74, 0x52 };
         PatternFinder finder      = new PatternFinder(_Process, new IntPtr(0xC50000), 0x20000);
         IntPtr        virtualAddr = finder.FindPattern(new byte[] { 0x3a, 0xC3, 0x0F, 0x84, 0x9F, 0x00, 0x00, 0x00, 0x38, 0x9D, 0xE0, 0x00, 0x00, 0x00, 0xC6, 0x45, 0x78, 0x01, 0x0F, 0x84, 0xA5, 0x00, 0x00, 0x00, 0x39, 0x9D, 0xF8, 0x00, 0x00, 0x00 }, 0x57);
         finder.ResetRegion();
         Console.WriteLine("Patching IP Check.");
         return(WriteProcessMemory(DNProcessHandle, virtualAddr, patchBytes, patchBytes.Length, 0));
     }
     catch (Exception ex)
     {
         Console.WriteLine("Couldn't get DN handle, restarting process.");
         return(false);
     }
 }