百度加固免费版分析及VMP修复
2020-03-08 17:14:19 Author: bbs.pediy.com(查看原文) 阅读量:220 收藏

[分享]机器码获取支持win10最新

3天前 735

bool getDevcieInfo(char* cmd, list<string> &resultList) {

    char buffer[BUFFER_SIZE];

    bool ret = false;

    FILE* pipe = _popen(cmd, "r"); //打开管道,并执行命令 

    if (!pipe)

        return ret;

    char *name[20] = { "UUID", "ProcessorId", "SerialNumber" };

    int len0 = strlen(name[0]), len1 = strlen(name[1]), len2 = strlen(name[2]);

    bool isOk = false;

    while (!feof(pipe)) {

        if (fgets(buffer, BUFFER_SIZE, pipe)) {

            if (strncmp(name[0], buffer, len0) == 0

                || strncmp(name[1], buffer, len1) == 0

                || strncmp(name[2], buffer, len2) == 0) // 能够正确获取信息

            {

                isOk = true;

                continue;

            }

            if (isOk == false

                || strcmp("\r\n", buffer) == 0) //去掉windows无用的空行

            {

                continue;

            }

            ret = true;

            resultList.push_back(string(buffer));

        }

    }

    _pclose(pipe); // 关闭管道 

    return ret;

}

string getDeviceFingerPrint() {

    list<string> strList;

    list<string>::iterator it;

    hash<string> str_hash;

    size_t num;

    char tmp[11] = { 0 };

    if (getDevcieInfo("wmic csproduct get UUID", strList)) {

        num = str_hash(*strList.begin());

        sprintf(tmp, "%u", num);

        return string(tmp);

    }

    string otherStr("");

    strList.clear();

    if (getDevcieInfo("wmic cpu get processorid", strList)) {

        otherStr.append(*strList.begin());

    }

    strList.clear();

    if (getDevcieInfo("wmic bios get serialnumber", strList)) {

        otherStr.append(*strList.begin());

    }

    strList.clear();

    if (getDevcieInfo("wmic diskdrive get serialnumber", strList)) {

        string allDiskNum("");

        for (it = strList.begin(); it != strList.end(); it++) {

            allDiskNum.append(*it);

        }

        otherStr.append(*strList.begin());

    }

    cout << str_hash(otherStr) << endl;

    num = str_hash(otherStr);

    sprintf(tmp, "%u", num);

    return string(tmp);

}

[招生]科锐逆向工程师培训(3月6日远程教学报名特惠, 第37期)


文章来源: https://bbs.pediy.com/thread-257937.htm
如有侵权请联系:admin#unsafe.sh