pidms-cli 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +0 -3
- package/index.js +5 -3
- package/machine-id.js +31 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* pidms CLI - Microsoft Product Key Inspector
|
|
5
5
|
*
|
|
6
6
|
* Powered by CID Portal (https://cidportal.win)
|
|
7
|
-
* Maintained by ActvKey (https://actvkey.com)
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
const { sanitizeKey, checkKey } = require('../index');
|
|
@@ -46,7 +45,6 @@ async function main() {
|
|
|
46
45
|
console.log(` npx pidms W269N-WFGWX-YVC9B-4J6C9-T83GX`);
|
|
47
46
|
console.log('');
|
|
48
47
|
console.log(`${colors.dim}Online Portal & Confirmation ID (CID): https://cidportal.win${colors.reset}`);
|
|
49
|
-
console.log(`${colors.dim}Maintained by ActvKey Open Source: https://actvkey.com${colors.reset}`);
|
|
50
48
|
process.exit(0);
|
|
51
49
|
}
|
|
52
50
|
|
|
@@ -88,7 +86,6 @@ async function main() {
|
|
|
88
86
|
${colors.cyan}=====================================================================
|
|
89
87
|
Need instant Confirmation ID (CID) for telephone activation?
|
|
90
88
|
Visit: https://cidportal.win
|
|
91
|
-
Developed & Maintained by ActvKey Open Source: https://actvkey.com
|
|
92
89
|
=====================================================================${colors.reset}
|
|
93
90
|
`);
|
|
94
91
|
} catch (err) {
|
package/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pidms - Microsoft Product Key Inspector SDK
|
|
3
3
|
*
|
|
4
|
-
* Maintained by ActvKey (https://actvkey.com)
|
|
5
4
|
* Powered by CID Portal (https://cidportal.win)
|
|
6
5
|
* License: MIT
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
const https = require('https');
|
|
9
|
+
const { getMachineId } = require('./machine-id');
|
|
10
10
|
|
|
11
11
|
function sanitizeKey(rawKey) {
|
|
12
12
|
if (!rawKey || typeof rawKey !== 'string') return '';
|
|
@@ -33,7 +33,8 @@ function checkKeys(keysArray) {
|
|
|
33
33
|
headers: {
|
|
34
34
|
'Content-Type': 'application/json',
|
|
35
35
|
'Content-Length': Buffer.byteLength(payload),
|
|
36
|
-
'
|
|
36
|
+
'X-Device-ID': getMachineId(), // Auto-creates CLI#001 in Key Vault!
|
|
37
|
+
'User-Agent': 'pidms-cli/1.0.2 (Node.js)'
|
|
37
38
|
},
|
|
38
39
|
timeout: 15000
|
|
39
40
|
}, (res) => {
|
|
@@ -72,5 +73,6 @@ async function checkKey(singleKey) {
|
|
|
72
73
|
module.exports = {
|
|
73
74
|
sanitizeKey,
|
|
74
75
|
checkKey,
|
|
75
|
-
checkKeys
|
|
76
|
+
checkKeys,
|
|
77
|
+
getMachineId
|
|
76
78
|
};
|
package/machine-id.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const { execSync } = require('child_process');
|
|
2
|
+
const crypto = require('crypto');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
|
|
6
|
+
function getMachineId() {
|
|
7
|
+
try {
|
|
8
|
+
if (process.platform === 'win32') {
|
|
9
|
+
const out = execSync('reg query "HKLM\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid', { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
|
|
10
|
+
const match = out.match(/MachineGuid\s+REG_SZ\s+([a-zA-Z0-9-]+)/i);
|
|
11
|
+
if (match && match[1]) {
|
|
12
|
+
return crypto.createHash('sha256').update(match[1].trim()).digest('hex');
|
|
13
|
+
}
|
|
14
|
+
} else if (process.platform === 'linux') {
|
|
15
|
+
const id = fs.existsSync('/etc/machine-id')
|
|
16
|
+
? fs.readFileSync('/etc/machine-id', 'utf8')
|
|
17
|
+
: fs.readFileSync('/var/lib/dbus/machine-id', 'utf8');
|
|
18
|
+
return crypto.createHash('sha256').update(id.trim()).digest('hex');
|
|
19
|
+
} else if (process.platform === 'darwin') {
|
|
20
|
+
const out = execSync('ioreg -rd1 -c IOPlatformExpertDevice', { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
|
|
21
|
+
const match = out.match(/"IOPlatformUUID"\s*=\s*"([^"]+)"/i);
|
|
22
|
+
if (match && match[1]) {
|
|
23
|
+
return crypto.createHash('sha256').update(match[1].trim()).digest('hex');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} catch (e) {}
|
|
27
|
+
const fallbackStr = os.hostname() + os.homedir() + (os.cpus()[0]?.model || 'cpu');
|
|
28
|
+
return crypto.createHash('sha256').update(fallbackStr).digest('hex');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = { getMachineId };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pidms-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Fast, lightweight CLI & SDK to inspect Microsoft Windows & Office product keys, detect license channels (Retail, OEM, Volume:MAK), and verify activation status.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|