Garip Bir CPU ID Sorunu
-
Selam arkadaşlar,
İlginç bir şey fark ettim, bir site için oyun uygulaması yaptım, site sahibi kaç kişinin programı yüklediğini ve o an aktif olanları da görmek
istediğini söyledi, bir api sistemi tasarladım ve webci arkadaş geçerli yaptı.buraya kadar sıkıntı yok..
programı 106 kişi indirmiş ancak kayıtlarda 11 tane görülüyor ki bunların bir kaç tanesini biz elle yazdık ve bi kaç tanesi de bizim bilgisayarla.yani harici olarak 3-4 tane dışardan kayıt almış.
.net framework u required yaptım, sistemde yoksa internet linkini açıyor indiriyor v.s. api leri de denedim bi problm yok ama 106 kişiden 3-4
kayıt alınması ilginç bi şeydi.
şimdi bi arkadaşla denedik baktım onun cpu id si eklenmemiş, şaşırdım tabii, harici bir program yolladım arkadaşa ve cpu idsini öğrendim,
benim ki ile aynısı. şimdi o kişi oyunu açtığında aktif, kapattığına pasif görünüyor, aynı id ben de de olduğu için ben açtığımda yine aktif pasif
değişiyor, yeni kullanıcı oluşturulmuyor çünkü id ler aynı. demek ki türkiyede bilgisayarlardaki cpu id leri çok çeşitli değil.
işin bir başka yanı arkadaşın cpu modeli ile benimki farklı. ama nasıl aynı oldu onu da anlamadım..
using System.Management; namespace XXXX { public class Utils { public static string GetProcessorID() { string sProcessorID = ""; string sQuery = "SELECT ProcessorId FROM Win32_Processor"; ManagementObjectSearcher oManagementObjectSearcher = new ManagementObjectSearcher(sQuery); ManagementObjectCollection oCollection = oManagementObjectSearcher.Get(); foreach (ManagementObject oManagementObject in oCollection) { sProcessorID = (string)oManagementObject["ProcessorId"]; } return (sProcessorID); } } }kullandığım kod bu şekilde..
anladım ki bu unique bir değer değil ya da gerçek anlamda cpu seri nosunu vermiyor. hdd nin seri numarasını almayı araştıracaım o biraz
karışıktı. piyasada var olan kodlar harddisk in volume nosunu veriyor o da her format atınca değişiyor.. mac adresini düşünüyorum da
onun haricinde cpu id için ne yapılabilir ? ortada bir problem var da ben mi göremiyorum
-
cpu id ile daha önce işim olmamıştı ama sadece modelden modele belki id değişiyor olabilir.
intel i7 3xxxx gibi .
hwid alarak çözmeyi dene durumu
edit: hdd nin kini dicektim eksik yazmışım.
FCN tarafından 24/Tem/13 12:35 tarihinde düzenlenmiştir -
belirli serilerde var, bendeki laptop core 2 due 2.5, arkadaşdaki 2.1 di ama o da core 2 due. kardeşimdeki i5 di onda farklı verdi bi arkadaş da
denedik o da i5 onun ki de farklı..
hwid derken neyin hwid isini alıyoruz anlamadım? x programındaki her hangi bir kontrolün bile hwid si açılıp kapanınca değişiyor. kast ettiğini anlamadım ?
-
Hocam bunu denermisin bi
class Program { [DllImport("user32", EntryPoint = "CallWindowProcW", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)] private static extern IntPtr CallWindowProcW([In] byte[] bytes, IntPtr hWnd, int msg, [In, Out] byte[] wParam, IntPtr lParam); [return: MarshalAs(UnmanagedType.Bool)] [DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)] public static extern bool VirtualProtect([In] byte[] bytes, IntPtr size, int newProtect, out int oldProtect); const int PAGE_EXECUTE_READWRITE = 0x40; static void Main(string[] args) { string s = ProcessorId(); Console.WriteLine("ProcessorId: " + s); Console.ReadLine(); } private static string ProcessorId() { byte[] sn = new byte[8]; if (!ExecuteCode(ref sn)) return "ND"; return string.Format("{0}{1}", BitConverter.ToUInt32(sn, 4).ToString("X8"), BitConverter.ToUInt32(sn, 0).ToString("X8")); } private static bool ExecuteCode(ref byte[] result) { int num; /* The opcodes below implement a C function with the signature: * __stdcall CpuIdWindowProc(hWnd, Msg, wParam, lParam); * with wParam interpreted as an 8 byte unsigned character buffer. * */ byte[] code_x86 = new byte[] { 0x55, /* push ebp */ 0x89, 0xe5, /* mov ebp, esp */ 0x57, /* push edi */ 0x8b, 0x7d, 0x10, /* mov edi, [ebp+0x10] */ 0x6a, 0x01, /* push 0x1 */ 0x58, /* pop eax */ 0x53, /* push ebx */ 0x0f, 0xa2, /* cpuid */ 0x89, 0x07, /* mov [edi], eax */ 0x89, 0x57, 0x04, /* mov [edi+0x4], edx */ 0x5b, /* pop ebx */ 0x5f, /* pop edi */ 0x89, 0xec, /* mov esp, ebp */ 0x5d, /* pop ebp */ 0xc2, 0x10, 0x00, /* ret 0x10 */ }; byte[] code_x64 = new byte[] { 0x53, /* push rbx */ 0x48, 0xc7, 0xc0, 0x01, 0x00, 0x00, 0x00, /* mov rax, 0x1 */ 0x0f, 0xa2, /* cpuid */ 0x41, 0x89, 0x00, /* mov [r8], eax */ 0x41, 0x89, 0x50, 0x04, /* mov [r8+0x4], edx */ 0x5b, /* pop rbx */ 0xc3, /* ret */ }; ref byte[] code; if (IsX64Process()) code = ref code_x64; else code = ref code_x86; IntPtr ptr = new IntPtr(code.Length); if (!VirtualProtect(code, ptr, PAGE_EXECUTE_READWRITE, out num)) Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); ptr = new IntPtr(result.Length); return (CallWindowProcW(code, IntPtr.Zero, 0, result, ptr) != IntPtr.Zero); } private static bool IsX64Process() { return IntPtr.Size == 8; } } -
yapılabilir mi bilmiyorum ama cpu id leri alacağına mac adresleri alsan? en azından herkesin farklı olduğunu biliyorsun
-
@dhmm, hocam benim yazdığım kodda aldığım aynı sonucu verdi BFEB...
ayrıca kodda bi sıkıntı vardı
ref byte[] code;
if (IsX64Process())
code = ref code_x64;
else
code = ref code_x86;
ref anahtar kelimesi bildiğim kadarıyla sadece fonksiyonlardaki parametrelerin başına eklenebiliyor, local fieldlerde bu tanımlama olmuyor, o yüzden hata verdi sildim çalıştı ve aynı numarayı verdi..
@sLeymN, evt hocam mac adresi alınır ve son çare onu kullanacağım gibi. ama yine de varsa alabileceğim seri noları iyi olur.
bu cpu id yi kullanmamın sebebi, bi tane iş güvenliği programını reflector ile açtım, adama baktım cpu id yi alarak bir matematiksel işlemden
geçirmiş ve seri no üretmiş, ben de aynı formülü uygulayarak key i buldum. sonra yazdığım programda sabit bir değer lazım oldu, aklıma ilk
gelen de bu cpu id oldu ama aynı olabileceğini hiç düşünmemiştim..
-
hocam mac adresi alınır ve son çare onu kullanacağım gibi
Ustad. MAC adresi network adapter(ag karti) ile alakalidir. Degistirildiginde o da degisir.
Ilk aklima gelen motherboardin id sini al. Kolay kolay degismez. Ztn onu degistirmek tum sistemi degistirmek giib olur.
Bunu bir dene bakalim
public String getMotherBoardID() { String serial = ""; try { ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT SerialNumber FROM Win32_BaseBoard"); ManagementObjectCollection moc = mos.Get(); foreach (ManagementObject mo in moc) { serial = mo["SerialNumber"].ToString(); } return serial; } catch (Exception) { return serial; } }
-
evet hocam mac adresinin fiziksel ağ kartına bağlı olduğunu biliyorum ama değiştirilmesi çok düşük bi ihtimal..
anakartın seri nosunu almak daha mantıklı haklısın ancak verdiğin kodda şöyle bir şey elde ettim "BSN12345678901234567"
numaraya bakınca pek de spesifik değil? 123456789 01234567 yazmışlar adamlar :)
-
ikisini de al o zaman.
hem cpuid hem mac al birlikte kullan. böylece daha çeşitli olur bence.
-
unbalanced bunu yazdı
evet hocam mac adresinin fiziksel ağ kartına bağlı olduğunu biliyorum ama değiştirilmesi çok düşük bi ihtimal..
anakartın seri nosunu almak daha mantıklı haklısın ancak verdiğin kodda şöyle bir şey elde ettim "BSN12345678901234567"
numaraya bakınca pek de spesifik değil? 123456789 01234567 yazmışlar adamlar :)
Hocam. MAC degistirmekten kastim. ADamin karti off cikar degistirir. Oyle yani.
Numaraya bakinca bende sasirdim 123.. mu olur la :)...
Neyse bir buna bak bakalim...
using System; using System.Management; using System.Security.Cryptography; using System.Security; using System.Collections; using System.Text; namespace Security { /// /// Generates a 16 byte Unique Identification code of a computer /// Example: 4876-8DB5-EE85-69D3-FE52-8CF7-395D-2EA9 /// public class FingerPrint { private static string fingerPrint = string.Empty; public static string Value() { if (string.IsNullOrEmpty(fingerPrint)) { fingerPrint = GetHash("CPU >> " + cpuId() + "\nBIOS >> " + biosId() + "\nBASE >> " + baseId() //+"\nDISK >> "+ diskId() + "\nVIDEO >> " + 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; } #region Original Device ID Getting Code //Return a hardware identifier 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; } //Return a hardware identifier 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() { //Uses first CPU identifier available in order of preference //Don't get all identifiers, as it is very time consuming string retVal = identifier("Win32_Processor", "UniqueId"); if (retVal == "") //If no UniqueID, use ProcessorID { retVal = identifier("Win32_Processor", "ProcessorId"); if (retVal == "") //If no ProcessorId, use Name { retVal = identifier("Win32_Processor", "Name"); if (retVal == "") //If no Name, use Manufacturer { retVal = identifier("Win32_Processor", "Manufacturer"); } //Add clock speed for extra security retVal += identifier("Win32_Processor", "MaxClockSpeed"); } } return retVal; } //BIOS Identifier 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"); } //Main physical hard drive ID private static string diskId() { return identifier("Win32_DiskDrive", "Model") + identifier("Win32_DiskDrive", "Manufacturer") + identifier("Win32_DiskDrive", "Signature") + identifier("Win32_DiskDrive", "TotalHeads"); } //Motherboard ID private static string baseId() { return identifier("Win32_BaseBoard", "Model") + identifier("Win32_BaseBoard", "Manufacturer") + identifier("Win32_BaseBoard", "Name") + identifier("Win32_BaseBoard", "SerialNumber"); } //Primary video controller ID private static string videoId() { return identifier("Win32_VideoController", "DriverVersion") + identifier("Win32_VideoController", "Name"); } //First enabled network card ID private static string macId() { return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled"); } #endregion } }
dhmm tarafından 24/Tem/13 12:37 tarihinde düzenlenmiştir -
sağolasın hocam bu güzele benziyor :) ama birazcık geç dönderiyor değeri. cpu id ve hdd id yi çıkartayım diğerlerini kullanayım güzel bi de algoritma yapmış :)
ayrıca cvp veren ilgi duyan arkadaşlara da teşekkürler
