获取有关电脑独特的东西,以创造一个免费试用 [英] Get something unique about a computer in order to create a free trial

查看:185
本文介绍了获取有关电脑独特的东西,以创造一个免费试用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有创造一个免费试用的几种方法。我,我还以为算法如下:

I know there are several ways of creating a free trials. My algorithm that I have thought is as follows:


  1. 得到的东西,标识安装应用程序的计算机。可以说,我选择了让这可能看起来像Windows产品编号:00247-OEM-8992485-00078

  1. get something that identifies the computer where the application is installed. lets say I chose to get the windows product ID which may look something like: 00247-OEM-8992485-00078.

然后散列这个字符串,说我结束与字符串:ckeer34kijr9f09uswcojskdfjsdk

then hash that string and say I end up with the string: ckeer34kijr9f09uswcojskdfjsdk

然后创建一个随机字母和数字的东西,看起来像一个文件:

then create a file with random letters and numbers something that looks like:

ksfjksdfjs98w73899wf89u289uf9289frmu2f98um98ry723tyr98re812y89897982433mc98lpokojiaytfwhjdegwdehjhdjwhbdwhdiwhd78ey8378er83r78rhy378wrgt37678er827yhe8162e682eg8gt66gt .....等

ksfjksdfjs98w73899wf89u289uf9289frmu2f98um98ry723tyr98re812y89897982433mc98lpokojiaytfwhjdegwdehjhdjwhbdwhdiwhd78ey8378er83r78rhy378wrgt37678er827yhe8162e682eg8gt66gt.....etc

然后上产生,这是随机的文件中找到的第二数量(在本例中是8)也发现了最后一个编号(在这种情况下,它是6)现在乘这些数字,你会得到48:那么这将是位置,我将开始把哈希字符串,我得到了它,如果你还记得是:ckeer34kijr9f09uswcojskdfjsdk因此文件的48字恰好是一个F,因此替换'F'与哈希字符串,它是C的第一个字符。所以替换c中的F。然后将两个字符到右边possition 50和放置下一个散列串字符等等...

then on the file that was random generated find the second number (in this case is 8) also find the last number (in this case it is 6) now multiply those numbers and you get 48: then that will be the position where I will start putting the hash string that I got which if you recall was: ckeer34kijr9f09uswcojskdfjsdk so the 48 character of the file happens to be a 'f' so replace that 'f' with the first character of the hash string which is c. so replace the f for c. then move two characters to the right to possition 50 and place the next hash string character etc...

我也可以加密文件,并以它解密到更安全。

I could also encrypt the file and unencrypt it in order to be more secure.

每次用户打开程序检查文件,看看它是否遵循algorith时间。如果不遵循算法那就意味着它不是一个完整版本的程序。

every time the user opens the program check that file and see if it follows the algorith. if it does not follow the algorithm then it means it is not a full version program.

所以,你可以看到我只需要获得有关计算机的一些独特的东西。我想到得到的Windows产品密钥其中,我认为将是独一无二的,但我不知道如何获取。我想另一件事渐渐的MAC地址。但我不认为它是有效的,因为如果用户改变它的网卡程序将无法正常工作。这是有关计算机的唯一的任何信息将帮助我很多。

so as you can see I just need to get something unique about the computer. I thought about getting the windows product key which that I think will be unique but I don't know how to get that. Another thing that I thought was getting the mac address. But I don't think that it is efficient because if the user changes it's nic card then the program will not work. Any information that is unique about the computer will help me a lot.

推荐答案

我知道很多公司使用的MAC地址这一点。我不知道有什么优点和缺点有这种方法,但它是值得研究的。

I know a lot of companies use the MAC address for this. I'm not sure what pros and cons there are to this approach, but it's worth looking into.

我相信你可以使用这样的方法来获取MAC地址

I believe you can use a method like this to get the MAC address:

/// <summary>
/// returns the mac address of the first operation nic found.
/// </summary>
/// <returns></returns>
private string GetMacAddress()
{
    string macAddresses = "";

    foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
    {
        if (nic.OperationalStatus == OperationalStatus.Up)
        {
            macAddresses += nic.GetPhysicalAddress().ToString();
            break;
        }
    }
    return macAddresses;
}

这太问题讨论得很详细:的Reliable方法来获取机器的MAC地址在C#

This SO question discusses it in detail: Reliable method to get machine's MAC address in C#

修改

正如其他人所指出的那样,MAC地址不能保证是唯一的。做了进一步的研究之后,有几个可能更好地工作的其他选项。该伸出我的两个是:

As others have pointed out, MAC address is not guaranteed to be unique. After doing a little more research, there are a couple of other options which might work better. The two that stuck out to me are:


  • 处理器序列号

  • 硬盘卷序列号(VSN)

获取处理器序列号:

using System.Management;

public string GetProcessorSerial()
{
    ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_BaseBoard");
    ManagementObjectCollection managementObjects = searcher.Get();

    foreach (ManagementObject obj in managementObjects)
    {
        if (obj["SerialNumber"] != null)
            return obj["SerialNumber"].Value.ToString();
    }

    return String.Empty;
}

获取硬盘序列号:

using System.Management;

public string GetHDDSerial()
{
    ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");    
    ManagementObjectCollection managementObjects = searcher.Get();

    foreach (ManagementObject obj in managementObjects)
    {
        if (obj["SerialNumber"] != null)
            return obj["SerialNumber"].ToString();
    }

    return string.Empty;
}

这篇关于获取有关电脑独特的东西,以创造一个免费试用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆