!!! ГАЙД ДЛЯ НОВИЧКОВ !!! Привет, уважаемый форумчанин. Сегодня я расскажу тебе, как сделать привязку по железу, через MySQL. Что нас с тобой понадобиться? Visual Studio База данных MySQL (можешь протестировать на локальной) Софт для защиты нашего проекта: Themida и т.п. (я буду использовать .NET Reactor) Шаг 1. Создание проекта и проектирование макета. Создаём новый проект WinForms или WPF (я использую WPF). Добавляем нужные нам контролы, в моём случае это выглядит так Посмотреть дизайн Шаг 2. HWID пользователя. Создаём событие на загрузку формы Добавляем в него следующее Код Value(); string hwid = fingerPrint; hwid = HashGo(hwid.ToString()); txtHwid.Text = hwid; // название TextBox`a Код Value(); string hwid = fingerPrint; hwid = HashGo(hwid.ToString()); txtHwid.Text = hwid; // название TextBox`a Добавляем кучу кода вне нашего события Код private bool status = false; private static string fingerPrint = string.Empty; public static string Value() { if (string.IsNullOrEmpty(fingerPrint)) { fingerPrint = GetHash("CPU >> " + cpuId() + "\nBIOS >> " + biosId() + "\nBASE >> " + baseId() + videoId() + "\nMAC >> " + macId()); } return fingerPrint; } private static string GetHash(string s) { MD5 sec = new MD5CryptoServiceProvider(); ASCIIEncoding enc = new ASCIIEncoding(); byte[] bt = enc.GetBytes(s); return GetHexString(sec.ComputeHash(bt)); } private static string GetHexString(byte[] bt) { string s = string.Empty; for (int i = 0; i < bt.Length; i++) { byte b = bt[i]; int n, n1, n2; n = (int)b; n1 = n & 15; n2 = (n >> 4) & 15; if (n2 > 9) s += ((char)(n2 - 10 + (int)'A')).ToString(); else s += n2.ToString(); if (n1 > 9) s += ((char)(n1 - 10 + (int)'A')).ToString(); else s += n1.ToString(); if ((i + 1) != bt.Length && (i + 1) % 2 == 0) s += "-"; } return s; } private static string identifier (string wmiClass, string wmiProperty, string wmiMustBeTrue) { string result = ""; System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass); System.Management.ManagementObjectCollection moc = mc.GetInstances(); foreach (System.Management.ManagementObject mo in moc) { if (mo[wmiMustBeTrue].ToString() == "True") { //Only get the first one if (result == "") { try { result = mo[wmiProperty].ToString(); break; } catch { } } } } return result; } private static string identifier(string wmiClass, string wmiProperty) { string result = ""; System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass); System.Management.ManagementObjectCollection moc = mc.GetInstances(); foreach (System.Management.ManagementObject mo in moc) { //Only get the first one if (result == "") { try { result = mo[wmiProperty].ToString(); break; } catch { } } } return result; } private static string cpuId() { string retVal = identifier("Win32_Processor", "UniqueId"); if (retVal == "") { retVal = identifier("Win32_Processor", "ProcessorId"); if (retVal == "") { retVal = identifier("Win32_Processor", "Name"); if (retVal == "") { retVal = identifier("Win32_Processor", "Manufacturer"); } retVal += identifier("Win32_Processor", "MaxClockSpeed"); } } return retVal; } private static string biosId() { return identifier("Win32_BIOS", "Manufacturer") + identifier("Win32_BIOS", "SMBIOSBIOSVersion") + identifier("Win32_BIOS", "IdentificationCode") + identifier("Win32_BIOS", "SerialNumber") + identifier("Win32_BIOS", "ReleaseDate") + identifier("Win32_BIOS", "Version"); } private static string diskId() { return identifier("Win32_DiskDrive", "Model") + identifier("Win32_DiskDrive", "Manufacturer") + identifier("Win32_DiskDrive", "Signature") + identifier("Win32_DiskDrive", "TotalHeads"); } private static string baseId() { return identifier("Win32_BaseBoard", "Model") + identifier("Win32_BaseBoard", "Manufacturer") + identifier("Win32_BaseBoard", "Name") + identifier("Win32_BaseBoard", "SerialNumber"); } private static string videoId() { return identifier("Win32_VideoController", "DriverVersion") + identifier("Win32_VideoController", "Name"); } private static string macId() { return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled"); } Код private bool status = false; private static string fingerPrint = string.Empty; public static string Value() { if (string.IsNullOrEmpty(fingerPrint)) { fingerPrint = GetHash("CPU >> " + cpuId() + "\nBIOS >> " + biosId() + "\nBASE >> " + baseId() + videoId() + "\nMAC >> " + macId()); } return fingerPrint; } private static string GetHash(string s) { MD5 sec = new MD5CryptoServiceProvider(); ASCIIEncoding enc = new ASCIIEncoding(); byte[] bt = enc.GetBytes(s); return GetHexString(sec.ComputeHash(bt)); } private static string GetHexString(byte[] bt) { string s = string.Empty; for (int i = 0; i < bt.Length; i++) { byte b = bt[i]; int n, n1, n2; n = (int)b; n1 = n & 15; n2 = (n >> 4) & 15; if (n2 > 9) s += ((char)(n2 - 10 + (int)'A')).ToString(); else s += n2.ToString(); if (n1 > 9) s += ((char)(n1 - 10 + (int)'A')).ToString(); else s += n1.ToString(); if ((i + 1) != bt.Length && (i + 1) % 2 == 0) s += "-"; } return s; } private static string identifier (string wmiClass, string wmiProperty, string wmiMustBeTrue) { string result = ""; System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass); System.Management.ManagementObjectCollection moc = mc.GetInstances(); foreach (System.Management.ManagementObject mo in moc) { if (mo[wmiMustBeTrue].ToString() == "True") { //Only get the first one if (result == "") { try { result = mo[wmiProperty].ToString(); break; } catch { } } } } return result; } private static string identifier(string wmiClass, string wmiProperty) { string result = ""; System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass); System.Management.ManagementObjectCollection moc = mc.GetInstances(); foreach (System.Management.ManagementObject mo in moc) { //Only get the first one if (result == "") { try { result = mo[wmiProperty].ToString(); break; } catch { } } } return result; } private static string cpuId() { string retVal = identifier("Win32_Processor", "UniqueId"); if (retVal == "") { retVal = identifier("Win32_Processor", "ProcessorId"); if (retVal == "") { retVal = identifier("Win32_Processor", "Name"); if (retVal == "") { retVal = identifier("Win32_Processor", "Manufacturer"); } retVal += identifier("Win32_Processor", "MaxClockSpeed"); } } return retVal; } private static string biosId() { return identifier("Win32_BIOS", "Manufacturer") + identifier("Win32_BIOS", "SMBIOSBIOSVersion") + identifier("Win32_BIOS", "IdentificationCode") + identifier("Win32_BIOS", "SerialNumber") + identifier("Win32_BIOS", "ReleaseDate") + identifier("Win32_BIOS", "Version"); } private static string diskId() { return identifier("Win32_DiskDrive", "Model") + identifier("Win32_DiskDrive", "Manufacturer") + identifier("Win32_DiskDrive", "Signature") + identifier("Win32_DiskDrive", "TotalHeads"); } private static string baseId() { return identifier("Win32_BaseBoard", "Model") + identifier("Win32_BaseBoard", "Manufacturer") + identifier("Win32_BaseBoard", "Name") + identifier("Win32_BaseBoard", "SerialNumber"); } private static string videoId() { return identifier("Win32_VideoController", "DriverVersion") + identifier("Win32_VideoController", "Name"); } private static string macId() { return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled"); } И ещё вот это добавляем Код static string HashGo(string input) { MD5 md5 = System.Security.Cryptography.MD5.Create(); byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input); byte[] hash = md5.ComputeHash(inputBytes); StringBuilder sb = new StringBuilder(); for (int i = 0; i < hash.Length; i++) { sb.Append(hash[i].ToString("X2")); } return sb.ToString(); } Код static string HashGo(string input) { MD5 md5 = System.Security.Cryptography.MD5.Create(); byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input); byte[] hash = md5.ComputeHash(inputBytes); StringBuilder sb = new StringBuilder(); for (int i = 0; i < hash.Length; i++) { sb.Append(hash[i].ToString("X2")); } return sb.ToString(); } Шаг 3. MySQL и привязка. Кидаем в событие загрузки этот код Код string connStr = $"server=%host%;user=&username%;database=%database%;password=%password%;"; MySqlConnection conn = new MySqlConnection(connStr); conn.Open(); DateTime d1; try { string sql = $"SELECT subscribe FROM myusers WHERE hwid = '{hwid}'"; MySqlCommand command = new MySqlCommand(sql, conn); string date = command.ExecuteScalar().ToString(); var client = new TcpClient("time.nist.gov", 13); using (var streamReader = new StreamReader(client.GetStream())) { var response = streamReader.ReadToEnd(); var utcDateTimeString = response.Substring(7, 17); d1 = DateTime.ParseExact(utcDateTimeString, "yy-MM-dd **:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); } DateTime d2 = Convert.ToDateTime(date); TimeSpan time = d2 - d1; int days = time.Days; if(days > 0) { btnLic.Content = $"Осталось {days} дней подписки"; btnLic.Background = clrGood.Background; btnLic.BorderBrush = clrGood.Background; btnBuyOrStart.Content = "Запустить"; status = true; } } catch(Exception ex) { btnLic.Content = "Не удалось подключиться"; } Код string connStr = $"server=%host%;user=&username%;database=%database%;password=%password%;"; MySqlConnection conn = new MySqlConnection(connStr); conn.Open(); DateTime d1; try { string sql = $"SELECT subscribe FROM myusers WHERE hwid = '{hwid}'"; MySqlCommand command = new MySqlCommand(sql, conn); string date = command.ExecuteScalar().ToString(); var client = new TcpClient("time.nist.gov", 13); using (var streamReader = new StreamReader(client.GetStream())) { var response = streamReader.ReadToEnd(); var utcDateTimeString = response.Substring(7, 17); d1 = DateTime.ParseExact(utcDateTimeString, "yy-MM-dd **:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); } DateTime d2 = Convert.ToDateTime(date); TimeSpan time = d2 - d1; int days = time.Days; if(days > 0) { btnLic.Content = $"Осталось {days} дней подписки"; btnLic.Background = clrGood.Background; btnLic.BorderBrush = clrGood.Background; btnBuyOrStart.Content = "Запустить"; status = true; } } catch(Exception ex) { btnLic.Content = "Не удалось подключиться"; } НЕ ЗАБУДЬТЕ ПОМЕНЯТЬ ЗНАЧЕНИЯ ДЛЯ ВАШЕЙ БАЗЫ ДАННЫХ. Шаг 4. Настройка базы данных. Создаём таблицу myusers Добавляем в неё id (int) hwid (char) subcribe (date) Всё готово, разбирайтесь, сурцы дам позже.
на сишурпе уже миллион примеров есть всего чего только можно придумать, было бы интересно посмотреть реализации на других языках
Cacich, бро, темида тебе не поможет, её реверсер нормальный снимет за пару минут, и панельку авторизации тоже снимут быстро
боже, братан, я же нигде не писал, что никто и никогда не реверснет софт, это нереально.. любой софт можно реверснуть, просто если он под протектом - это мало кому доставит удовольствия хорош тебе докапываться, я показал примитивный пример привязки .-.