using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;


namespace ExploitlySpoofer
{
    class Main
    {
        public static void AsciiText()
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("   ____           __     _ __  __       ____               ___       ");
            Console.WriteLine("  / __/_ __ ___  / /__  (_) /_/ /_ __  / __/__  ___  ___  / _/__ ____");
            Console.WriteLine(" / _/ \\ \\ // _ \\/ / _ \\/ / __/ / // / _\\ \\/ _ \\/ _ \\/ _ \\/ _/ -_) __/");
            Console.WriteLine("/___//_\\_\\/ .__/_/\\___/_/\\__/_/\\_, / /___/ .__/\\___/\\___/_/ \\__/_/   ");
            Console.WriteLine("         /_/                  /___/     /_/                          ");
            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine();
            Console.WriteLine("Join our Discord Community!");
            Console.WriteLine("https://dsc.gg/exploitly");
            Console.ForegroundColor = ConsoleColor.Green;
        }

        public static void CheckHWID()
        {
            try
            {
                Console.Clear();

                string key = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles\\0001";

                string guid = (string)Registry.GetValue(key, "GUID", (object)"default");

                Console.WriteLine("[Exploitly Spoofer] Current HWID: " + guid);

                Console.ReadKey();
            }
            catch (Exception)
            {
                Console.Clear();

                Console.ForegroundColor = ConsoleColor.Red;

                Console.WriteLine("[Exploitly Spoofer] There was an error while getting your HWID");

                Console.ReadKey();
            }
        }

        public static void SpoofHWID()
        {
            try
            {
                Console.Clear();

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("[Exploitly Spoofer] Yours custom HWID should looks like this");
                Console.WriteLine("CustomName-12345-12345-1234-123456789");
                Console.WriteLine("");
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("WRONG HWID CAN DESTROY YOUR REGISTRY");
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("\n Type your custom HWID: ");
                var CustomHWID = Console.ReadLine();

                string key = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles\\0001";

                string oldHwid = (string)Registry.GetValue(key, "HwProfileGuid", (object)"default");

                string newHwid = "{" + CustomHWID + "}";

                Registry.SetValue(key, "GUID", (object)newHwid);

                Registry.SetValue(key, "HwProfileGuid", (object)newHwid);

                Console.WriteLine("[Exploitly Spoofer] Successfully Changed Your HWID!");

                Console.WriteLine("\n[Exploitly Spoofer] Old HWID: " + oldHwid);

                Console.WriteLine("\n[Exploitly Spoofer] New HWID: " + newHwid);

                Console.ReadKey();

            }
            catch (Exception)
            {
                Console.Clear();

                Console.ForegroundColor = ConsoleColor.Red;

                Console.WriteLine("[Exploitly Spoofer] - Failed to change HWID, try to run this as administrator");

                Console.ReadKey();

            }
        }

        public static void RandomSpoofHWID()
        {
            try
            {
                Console.Clear();

                string key = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles\\0001";

                string oldHwid = (string)Registry.GetValue(key, "HwProfileGuid", (object)"default");

                string newHwid = "{TryAgain-" + GenID(5) + "-" + GenID(5) + "-" + GenID(4) + "-" + GenID(9) + "}";

                Registry.SetValue(key, "GUID", (object)newHwid);

                Registry.SetValue(key, "HwProfileGuid", (object)newHwid);

                Console.WriteLine("[Exploitly Spoofer] Successfully Changed Your HWID!");

                Console.WriteLine("\n[Exploitly Spoofer] Old HWID: " + oldHwid);

                Console.WriteLine("\n[Exploitly Spoofer] New HWID: " + newHwid);

                Console.ReadKey();

            }
            catch (Exception)
            {
                Console.Clear();

                Console.ForegroundColor = ConsoleColor.Red;

                Console.WriteLine("[Exploitly Spoofer] - Failed to change HWID, try to run this as administrator");

                Console.ReadKey();

            }
        }

        private static Random random = new Random();

        public static string GenID(int length)
        {
            string chars = "126345879";
            return new string(Enumerable.Repeat(chars, length).Select(s => s[random.Next(s.Length)]).ToArray());
        }
    }
}
