diff --git a/Kye.csproj b/Kye.csproj new file mode 100644 index 0000000..0d18e1e --- /dev/null +++ b/Kye.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {7E35C20A-8872-42EE-99EE-855EC260DA57} + Library + Properties + Kye + Kye + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Kye.sln b/Kye.sln new file mode 100644 index 0000000..c715496 --- /dev/null +++ b/Kye.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30002.166 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kye", "Kye.csproj", "{7E35C20A-8872-42EE-99EE-855EC260DA57}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7E35C20A-8872-42EE-99EE-855EC260DA57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E35C20A-8872-42EE-99EE-855EC260DA57}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E35C20A-8872-42EE-99EE-855EC260DA57}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E35C20A-8872-42EE-99EE-855EC260DA57}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {28F96139-7456-4ADC-A330-DE60113B9DE9} + EndGlobalSection +EndGlobal diff --git a/KyeBool.cs b/KyeBool.cs new file mode 100644 index 0000000..623f09f --- /dev/null +++ b/KyeBool.cs @@ -0,0 +1,28 @@ +using System; +using System.Net; +namespace Kye +{ + public static class KyeBool + { + public static bool HasInternet() + { + using (WebClient webClient = new WebClient()) + { + try + { + string a = webClient.DownloadString("https://google.com"); + return true; + } + catch + { + return false; + } + } + } + public static bool RandomBool() + { + Random rng = new Random(); + return rng.Next(0, 2) > 0; + } + } +} diff --git a/KyeFunction.cs b/KyeFunction.cs new file mode 100644 index 0000000..059114e --- /dev/null +++ b/KyeFunction.cs @@ -0,0 +1,84 @@ +using System.Diagnostics; +using System.Net; +using System.Collections.Specialized; +using System.Windows.Forms; +using System; +using System.Runtime.InteropServices; +using System.IO; +using System.Text; +namespace Kye +{ + public class KyeFunction + { + public static void sendDiscordWebhook(string URL, string profilepic, string username, string message) + { + using (WebClient web = new WebClient()) + { + NameValueCollection discordValues = new NameValueCollection(); + discordValues.Clear(); + discordValues.Add("username", username); + discordValues.Add("avatar_url", profilepic); + discordValues.Add("content", message); + web.UploadValues(URL, discordValues); + } + } + public static void CheckForMalicious() + { + Process[] processlist = Process.GetProcesses(); + foreach (Process theprocess in processlist) + { + if (theprocess.ProcessName.Contains("Fiddler") | theprocess.ProcessName.Contains("HTTP") && theprocess.ProcessName.Contains("Debug")) + theprocess.Kill(); + } + } + + public static void CheckMD5(string url_with_official_md5, [Optional] string optional_message_to_show_when_modified) + { + WebClient webClient = new WebClient(); + string websitehash = webClient.DownloadString(url_with_official_md5); + string programhash = KyeString.GetThisMD5(); + string programname = AppDomain.CurrentDomain.FriendlyName.Replace(".exe", ""); + if (!websitehash.Contains(programhash)) + { + if (optional_message_to_show_when_modified == null) + { + MessageBox.Show("This program has been modified and is NOT official. Please download the original one", programname,MessageBoxButtons.OK, MessageBoxIcon.Error); + Environment.Exit(0); + } + else + { + MessageBox.Show(optional_message_to_show_when_modified, programname, MessageBoxButtons.OK, MessageBoxIcon.Error); + Environment.Exit(0); + } + } + webClient.Dispose(); + } + + public static void DeleteFile(string filename) + { + if (File.Exists(filename)) + File.Delete(filename); + } + + public static void WriteLine(string filepath, string newText, int line_to_edit) + { + string programname = AppDomain.CurrentDomain.FriendlyName.Replace(".exe", ""); + try + { + string[] arrLine = File.ReadAllLines(filepath, Encoding.UTF8); + arrLine[line_to_edit - 1] = newText; + File.WriteAllLines(filepath, arrLine); + } + catch (IndexOutOfRangeException) + { + MessageBox.Show("Line " + line_to_edit + " does not exist in " + filepath, programname, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + catch (Exception ex) + { + + MessageBox.Show(ex.Message, programname, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + } +} diff --git a/KyeInt.cs b/KyeInt.cs new file mode 100644 index 0000000..7a0b205 --- /dev/null +++ b/KyeInt.cs @@ -0,0 +1,17 @@ +using System; +namespace Kye +{ + public class KyeInt + { + public static int RandomInt(int min, int max) + { + Random random = new Random(); + return random.Next(min, max); + } + public static int GetGPUCount() + { + int gpucount = KyeString.GetGPU().Length - 1; + return gpucount; + } + } +} diff --git a/KyeString.cs b/KyeString.cs new file mode 100644 index 0000000..7aa9c58 --- /dev/null +++ b/KyeString.cs @@ -0,0 +1,196 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Net; +using System.Security.Cryptography; +using System.IO; +using System.Management; +using Microsoft.Win32; +using System.Windows.Forms; + +namespace Kye +{ + public class KyeString + { + public static string GetIP() + { + try + { + using (WebClient web = new WebClient()) + { + return web.DownloadString("http://ip-api.com/line/?fields=8192"); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + return ""; + } + + } + public static string GetHWID() + { + return GetSha256(GetMachineGuid() + GetCPUID()); + } + + private static string GetCPUID() + { + var mbs = new ManagementObjectSearcher("Select ProcessorId From Win32_processor"); + ManagementObjectCollection mbsList = mbs.Get(); + foreach (ManagementObject mo in mbsList) + { + return mo["ProcessorId"].ToString(); + } + return "none"; + } + + private static string GetMachineGuid() + { + string location = @"SOFTWARE\Microsoft\Cryptography"; + string name = "MachineGuid"; + + using (RegistryKey localMachineX64View = + RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) + { + using (RegistryKey rk = localMachineX64View.OpenSubKey(location)) + { + if (rk == null) + throw new KeyNotFoundException( + string.Format("Key Not Found: {0}", location)); + + object machineGuid = rk.GetValue(name); + if (machineGuid == null) + throw new IndexOutOfRangeException( + string.Format("Index Not Found: {0}", name)); + + return machineGuid.ToString(); + } + } + } + static string GetSha256(string rawData) + { + // Create a SHA256 + using (SHA256 sha256Hash = SHA256.Create()) + { + // ComputeHash - returns byte array + byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(rawData)); + + // Convert byte array to a string + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < bytes.Length; i++) + { + builder.Append(bytes[i].ToString("x2")); + } + return builder.ToString(); + } + } + private static Random random = new Random(); + public static string RandomString(int length) + { + const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + return new string(Enumerable.Repeat(chars, length) + .Select(s => s[random.Next(s.Length)]).ToArray()); + } + + public static string RandomStringWithoutNumbers(int length) + { + const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + return new string(Enumerable.Repeat(chars, length) + .Select(s => s[random.Next(s.Length)]).ToArray()); + } + + public static string Encodebase64(string TextToEncode) + { + var plainTextBytes = Encoding.UTF8.GetBytes(TextToEncode); + return Convert.ToBase64String(plainTextBytes); + } + public static string DecodeBase64(string base64EncodedData) + { + var base64EncodedBytes = Convert.FromBase64String(base64EncodedData); + return Encoding.UTF8.GetString(base64EncodedBytes); + } + + public static string GetMD5(string filename) + { + using (var md5 = MD5.Create()) + { + using (var stream = File.OpenRead(filename)) + { + var hash = md5.ComputeHash(stream); + return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); + } + } + } + + public static string GetThisMD5() + { + using (var md5 = MD5.Create()) + { + using (var stream = File.OpenRead(AppDomain.CurrentDomain.FriendlyName)) + { + var hash = md5.ComputeHash(stream); + return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant(); + } + } + } + public static string InstalledRAM() + { + ObjectQuery wql = new ObjectQuery("SELECT * FROM Win32_OperatingSystem"); + ManagementObjectSearcher searcher = new ManagementObjectSearcher(wql); + ManagementObjectCollection results = searcher.Get(); + + double res; + double fres = 0; + foreach (ManagementObject result in results) + { + res = Convert.ToDouble(result["TotalVisibleMemorySize"]); + fres = Math.Round((res / (1024 * 1024)), 2); + } + return fres + "GB"; + } + + public static string[] GetGPU() + { + string gpu = ""; + ManagementObjectSearcher objvide = new ManagementObjectSearcher("select * from Win32_VideoController"); + + foreach (ManagementObject obj in objvide.Get()) + { + if (obj["Name"].ToString().All(char.IsLetterOrDigit)); + { + gpu += obj["Name"] + "|".ToString(); + } + } + string[] gpus = gpu.Split('|'); + return gpus; + } + + public static string ReadLine(string fileName, int line) + { + using (var sr = new StreamReader(fileName)) + { + for (int i = 1; i < line; i++) + sr.ReadLine(); + return sr.ReadLine(); + } + } + + public static string GetCountry() + { + try + { + using (WebClient web = new WebClient()) + { + return web.DownloadString("http://ip-api.com/line/?fields=1"); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + return ""; + } + + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a838074 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Kye")] +[assembly: AssemblyDescription("Make coding easier with Kye.dll (.NET Framework 4.7.2)")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Kye")] +[assembly: AssemblyProduct("Kye")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("Kye")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("7e35c20a-8872-42ee-99ee-855ec260da57")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.0.0.1")] +[assembly: AssemblyFileVersion("0.0.0.1")] diff --git a/bin/Debug/Kye.dll b/bin/Debug/Kye.dll new file mode 100644 index 0000000..f72fa04 Binary files /dev/null and b/bin/Debug/Kye.dll differ diff --git a/bin/Debug/Kye.pdb b/bin/Debug/Kye.pdb new file mode 100644 index 0000000..9bc8283 Binary files /dev/null and b/bin/Debug/Kye.pdb differ diff --git a/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/obj/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000..13fd2ff Binary files /dev/null and b/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..bf44663 Binary files /dev/null and b/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/obj/Debug/Kye.csproj.CoreCompileInputs.cache b/obj/Debug/Kye.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..af6f673 --- /dev/null +++ b/obj/Debug/Kye.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +fbc12eec2d4f45b779928957fe974ce375e99040 diff --git a/obj/Debug/Kye.csproj.FileListAbsolute.txt b/obj/Debug/Kye.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..ecf1fd0 --- /dev/null +++ b/obj/Debug/Kye.csproj.FileListAbsolute.txt @@ -0,0 +1,6 @@ +C:\Users\ProMa\source\repos\Kye\bin\Debug\Kye.dll +C:\Users\ProMa\source\repos\Kye\bin\Debug\Kye.pdb +C:\Users\ProMa\source\repos\Kye\obj\Debug\Kye.csprojAssemblyReference.cache +C:\Users\ProMa\source\repos\Kye\obj\Debug\Kye.csproj.CoreCompileInputs.cache +C:\Users\ProMa\source\repos\Kye\obj\Debug\Kye.dll +C:\Users\ProMa\source\repos\Kye\obj\Debug\Kye.pdb diff --git a/obj/Debug/Kye.csprojAssemblyReference.cache b/obj/Debug/Kye.csprojAssemblyReference.cache new file mode 100644 index 0000000..cc76628 Binary files /dev/null and b/obj/Debug/Kye.csprojAssemblyReference.cache differ diff --git a/obj/Debug/Kye.dll b/obj/Debug/Kye.dll new file mode 100644 index 0000000..f72fa04 Binary files /dev/null and b/obj/Debug/Kye.dll differ diff --git a/obj/Debug/Kye.pdb b/obj/Debug/Kye.pdb new file mode 100644 index 0000000..9bc8283 Binary files /dev/null and b/obj/Debug/Kye.pdb differ