Ejemplo n.º 1
0
        // Token: 0x06000BE8 RID: 3048 RVA: 0x00023BE8 File Offset: 0x00021DE8
        public static string GetHwid(HwidStrength hwidStrength, bool ignoreNullValues = false)
        {
            string text = null;
            uint?  num  = null;

            foreach (Processor processor in HardwareGatherer.GetProcessors())
            {
                if (processor.Id != null)
                {
                    text = processor.Id;
                }
            }
            foreach (HardDrive hardDrive in HardwareGatherer.GetHardDrives())
            {
                if (hardDrive.Signature != null)
                {
                    num = hardDrive.Signature;
                }
            }
            string serialNumber     = BiosGatherer.GetSerialNumber();
            string activeMacAddress = NetGatherer.GetActiveMacAddress();

            switch (hwidStrength)
            {
            case HwidStrength.Light:
                if (ignoreNullValues || text != null)
                {
                    return(DataRecoveryHelper.GetMd5Hash(text + Environment.UserName).Replace("-", string.Empty));
                }
                return(null);

            case HwidStrength.Medium:
                if (ignoreNullValues || (text != null && num != null))
                {
                    return(DataRecoveryHelper.GetMd5Hash(text + num + Environment.UserName).Replace("-", string.Empty));
                }
                return(null);

            case HwidStrength.Strong:
                if (ignoreNullValues || (text != null && num != null && serialNumber != null && activeMacAddress != null))
                {
                    return(DataRecoveryHelper.GetMd5Hash(string.Concat(new object[]
                    {
                        text,
                        num,
                        serialNumber,
                        activeMacAddress,
                        Environment.UserName
                    })).Replace("-", string.Empty));
                }
                return(null);

            default:
                return(null);
            }
        }
Ejemplo n.º 2
0
        public static string GetHwid(HwidStrength hwidStrength, bool ignoreNullValues = false)
        {
            string text  = null;
            uint?  num   = null;
            string text2 = null;
            string text3 = null;

            foreach (Processor processor in GetProcessors())
            {
                if (processor.Id != null)
                {
                    text = processor.Id;
                }
            }
            foreach (HardDrive hardDrife in GetHardDrives())
            {
                if (hardDrife.Signature.HasValue)
                {
                    num = hardDrife.Signature;
                }
            }
            text2 = BiosGatherer.GetSerialNumber();
            text3 = NetGatherer.GetActiveMacAddress();
            switch (hwidStrength)
            {
            case HwidStrength.Light:
                if (ignoreNullValues || text != null)
                {
                    return(DataRecoveryHelper.GetMd5Hash(text + Environment.UserName).Replace("-", string.Empty));
                }
                return(null);

            case HwidStrength.Medium:
                if (ignoreNullValues || (text != null && num.HasValue))
                {
                    return(DataRecoveryHelper.GetMd5Hash(text + num + Environment.UserName).Replace("-", string.Empty));
                }
                return(null);

            case HwidStrength.Strong:
                if (ignoreNullValues || (text != null && num.HasValue && text2 != null && text3 != null))
                {
                    return(DataRecoveryHelper.GetMd5Hash(text + num + text2 + text3 + Environment.UserName).Replace("-", string.Empty));
                }
                return(null);

            default:
                return(null);
            }
        }