- 积分
- 746
- 最后登录
- 2024-1-29
- 精华
- 0
- 阅读权限
- 40
- 主题
- 24
- UID
- 2819285
- 帖子
- 1070
- PB币
- 344
- 威望
- 53
- 贡献
- 0
- 技术
- 1
- 活跃
- 852
- UID
- 2819285
- 帖子
- 1070
- PB币
- 344
- 贡献
- 0
- 技术
- 1
- 活跃
- 852
|
7F
发表于 2015-8-25 10:15:08
IP属地广东
|只看该作者
raymai97 发表于 2015-8-25 10:08
假key的出现让pidgen再也不靠谱了
T_T
但pidgen的源码(好像是),是通过Socket向微软服务器请求来进行Mak 计数的,那就是微软的问题了- string PIDXChecker::GetCount(wstring wszPID) {
- wszPID.replace(0, 5, L"12345");
- int count = -1;
- string szReturnString = "Not Available";
- wstring szRequestInnerBody =
- L"<ActivationRequest xmlns=\"http://www.microsoft.com/DRM/SL/BatchActivationRequest/1.0\"><VersionNumber>2.0</VersionNumber><RequestType>2</RequestType><Requests><Request><PID>" +
- wszPID + L"</PID></Request></Requests></ActivationRequest>";
- byte* bSecretKey =
- "\xfe\x31\x98\x75\xfb\x48\x84\x86\x9c\xf3\xf1\xce\x99\xa8\x90\x64\xab\x57\x1f\xca\x47\x04\x50\x58\x30\x24\xe2\x14\x62\x87\x79\xa0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
- byte * bRequestInnerBody = (byte*)(szRequestInnerBody.c_str());
- boost::uint8_t digest[32];
- hmac<sha256>::calc(bRequestInnerBody, szRequestInnerBody.length()*2, bSecretKey, 32, digest);
- string Digest = base64::encode_from_array(digest, 32).c_str();
- string Basec64 = base64::encode_from_array(bRequestInnerBody, szRequestInnerBody.length() * 2).c_str();
- string szFormData =
- "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><BatchActivate xmlns=\"http://www.microsoft.com/BatchActivationService\"><request><Digest>" +
- Digest + "</Digest><RequestXml>" + Basec64 +
- "</RequestXml></request></BatchActivate></soap:Body></soap:Envelope>";
- static char hdrs[] =
- "Content-Type: text/xml; charset=utf-8\r\nSOAPAction: \"http://www.microsoft.com/BatchActivationService/BatchActivate\"\r\nExpect: 100-continue";
- char* frmdata = const_cast<char*>(szFormData.c_str());
- // for clarity, error-checking has been removed
- HINTERNET hSession =
- InternetOpenA("Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.1)",
- // User Agent
- INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
- HINTERNET hConnect = InternetConnectA(hSession, "activation.sls.microsoft.com", INTERNET_DEFAULT_HTTPS_PORT, NULL,
- NULL, INTERNET_SERVICE_HTTP, 0, 1);
- HINTERNET hRequest = HttpOpenRequestA(hConnect, "POST", "/BatchActivation/BatchActivation.asmx", "HTTP/1.1", NULL,
- NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_IGNORE_CERT_CN_INVALID | INTERNET_FLAG_IGNORE_CERT_DATE_INVALID, 1);
- HttpSendRequestA(hRequest, hdrs, strlen(hdrs), frmdata, strlen(frmdata));
- char responseText[256]; // change to wchar_t for unicode
- DWORD responseTextSize = sizeof(responseText);
- HttpQueryInfoA(hRequest, HTTP_QUERY_STATUS_CODE, &responseText, &responseTextSize, NULL);
- string response(responseText, responseTextSize);
- if (response == "200") {
- char* data = NULL;
- DWORD dataSize = 0;
- DWORD dwBytesRead = 0;
- DWORD dwBytesWritten = 0;
- do {
- char buffer[2000];
- InternetReadFile(hRequest, (LPVOID)buffer, sizeof(buffer), &dwBytesRead);
- char *tempData = new char[dataSize + dwBytesRead];
- memcpy(tempData, data, dataSize);
- memcpy(tempData + dataSize, buffer, dwBytesRead);
- delete[]data;
- // delete buffer;
- data = tempData;
- dataSize += dwBytesRead;
- }
- while (dwBytesRead);
- string page = string(data, dataSize);
- vector<char>inner_xml(page.begin(), page.end());
- xml_document<>doc;
- xml_node<> *rootNode;
- try {
- // Note that it will auto-parse HTML entities
- doc.parse<0>(&inner_xml[0]);
- // root -> soap:Envelope
- rootNode = doc.first_node();
- if (rootNode) { // -> soap:Body
- rootNode = rootNode->first_node();
- if (rootNode) { // -> BatchActivateResponse
- rootNode = rootNode->first_node();
- if (rootNode) { // -> BatchActivateResult
- rootNode = rootNode->first_node();
- if (rootNode) { // -> ResponseXml
- rootNode = rootNode->first_node();
- if (rootNode) {
- string value = rootNode->value();
- vector<char>inner_xml(value.begin(), value.end());
- doc.clear();
- doc.parse<0>(&inner_xml[0]);
- // root -> ActivationResponse
- rootNode = doc.first_node();
- if (rootNode) { // -> Responses
- rootNode = rootNode->last_node();
- if (rootNode) { // -> Response
- rootNode = rootNode->first_node();
- if (rootNode) { // -> ActivationRemaining
- rootNode = rootNode->first_node("ActivationRemaining");
- if (rootNode) { // ActivationRemaining->value
- szReturnString = rootNode->value();
- if (atoi(szReturnString.c_str()) < 0) {
- // -> ErrorInfo
- rootNode = rootNode->parent()->last_node();
- if (rootNode) { // -> ErrorCode
- rootNode = rootNode->first_node();
- if (rootNode) {
- if (string(rootNode->value()) == "0x67")
- szReturnString = "Key blocked!";
- else
- szReturnString = "Error " + string(rootNode->value());
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- catch (parse_error err) {
- MessageBoxA(NULL, err.what(), "XML Parse Error!", MB_OK);
- doc.clear();
- return "";
- }
- doc.clear();
- }
- InternetCloseHandle(hRequest);
- InternetCloseHandle(hConnect);
- InternetCloseHandle(hSession);
- return szReturnString;
- }
复制代码 这是我在hub上找的pidchecker 的类 |
|