Results 1 to 5 of 5
  1. #1
    Kantanomo's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    32
    Reputation
    10
    Thanks
    12
    My Mood
    Psychedelic

    Generic PC Identifier Class.

    Nothing Fancy just as title says

    -Note: Made by me free to use how every you want.

    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Collections;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Diagnostics;
    using System.IO;
    using System.Text.RegularExpressions;
    using System.Net;
    using System.Xml;
    using System.IO.Compression;
    using System****ntime.InteropServices;
    using System.Media;
    using System.Threading;
    using System.Management;
    using Microsoft.Win32;
    using System.Net.NetworkInformation;
    using System.Security.Cryptography;
    namespace GenericPCID
    {
    
        public class PCID
        {
            public static string GetCPUId()
            {
                #region CPUid
                string cpuInfo = String.Empty;
                string temp = String.Empty;
                ManagementClass mc = new ManagementClass("Win32_Processor");
                ManagementObjectCollection moc = mc.GetInstances();
                foreach (ManagementObject mo in moc)
                {
                    if (cpuInfo == String.Empty)
                    {
                        cpuInfo = mo.Properties["ProcessorId"].Value.ToString();
                    }
                }
                return cpuInfo;
                #endregion
            }
            public static string GetMotherBoardID()
            {
                #region Mboard
                ManagementObjectCollection mbCol = new ManagementClass("Win32_BaseBoard").GetInstances();
                ManagementObjectCollection.ManagementObjectEnumerator mbEnum = mbCol.GetEnumerator();
                mbEnum.MoveNext();
                return ((ManagementObject)(mbEnum.Current)).Properties["SerialNumber"].Value.ToString();
                #endregion
            }
            public static string GetMacAddress()
            {
                #region MacAddress
                string macs = "";
                NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
                foreach (NetworkInterface ni in interfaces)
                {
                    PhysicalAddress pa = ni.GetPhysicalAddress();
                    macs += pa.ToString();
                }
                return macs;
                #endregion
            }
            public static string GetVolumeSerial()
            {
                #region HD serial
                string strDriveLetter = "";
                ManagementClass mc = new ManagementClass("Win32_PhysicalMedia");
                ManagementObjectCollection moc = mc.GetInstances();
                foreach (ManagementObject mo in moc)
                {
                    try
                    {
                        if ((UInt16)mo["MediaType"] == 29)
                        {
                            String serial = mo["SerialNumber"].ToString().Trim();
                            if (!String.IsNullOrEmpty(serial))
                            {
                                strDriveLetter = (string)mo["SerialNumber"];
                                return strDriveLetter;
                            }
                        }
                    }
                    catch { }
                }
                return strDriveLetter;
                #endregion
            }
            public static string GetGenericID()
            {
                #region UID
                string ID = GetCPUId()  + GetMotherBoardID()  + GetMacAddress()  + GetVolumeSerial();
                HMACSHA1 hmac = new HMACSHA1();
                hmac.Key = Encoding.ASCII.GetBytes(GetMotherBoardID());
                hmac.ComputeHash(Encoding.ASCII.GetBytes(ID));
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < hmac.Hash.Length; i++)
                {
                    sb.Append(hmac.Hash[i].ToString("X2"));
                }
                return sb.ToString();
                #endregion
            }
        }
    }
    To get the generic PCID use the GetGenericID(); function.
    Last edited by Kantanomo; 05-25-2011 at 06:12 PM.

  2. #2
    Stephen's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Engine.exe
    Posts
    4,689
    Reputation
    184
    Thanks
    1,149
    My Mood
    Aggressive
    Thanks.

  3. #3
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,685
    My Mood
    Mellow
    I'm not sure you know what generics are.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  4. #4
    Kantanomo's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    32
    Reputation
    10
    Thanks
    12
    My Mood
    Psychedelic
    Quote Originally Posted by Cho Chang View Post
    I'm not sure you know what generics are.

    Code:
    ge·ner·ic
    
    Characteristic of or relating to a class or group of things; not specific
    - chèvre is a generic term for all goat's milk cheese
    My C# Posts. (I code all my own code)


    Coding Experiance:
    • VB = None its GayShit.
    • C# = 2 years (Indermediate/Advanced)
    • C++ = 5 months (Beginner)
    • HTML = 1 year (Beginner)

  5. #5
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,685
    My Mood
    Mellow
    Exactly, and I see no generics used in that code

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)