systeminformation 5.23.17 → 5.23.19
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/lib/cpu.js +14 -0
- package/lib/internet.js +7 -45
- package/lib/network.js +5 -2
- package/lib/util.js +37 -0
- package/package.json +1 -1
package/lib/cpu.js
CHANGED
|
@@ -605,6 +605,9 @@ function cpuManufacturer(str) {
|
|
|
605
605
|
if (str.indexOf('Xen') >= 0) { result = 'Xen Hypervisor'; }
|
|
606
606
|
if (str.indexOf('tcg') >= 0) { result = 'QEMU'; }
|
|
607
607
|
if (str.indexOf('apple') >= 0) { result = 'Apple'; }
|
|
608
|
+
if (str.indexOf('sifive') >= 0) { result = 'SiFive'; }
|
|
609
|
+
if (str.indexOf('thead') >= 0) { result = 'T-Head'; }
|
|
610
|
+
if (str.indexOf('andestech') >= 0) { result = 'Andes Technology'; }
|
|
608
611
|
|
|
609
612
|
return result;
|
|
610
613
|
}
|
|
@@ -788,6 +791,17 @@ function getCpu() {
|
|
|
788
791
|
}
|
|
789
792
|
}
|
|
790
793
|
|
|
794
|
+
// Test RISC-V
|
|
795
|
+
if (util.getValue(lines, 'architecture') === 'riscv64') {
|
|
796
|
+
const linesRiscV = fs.readFileSync('/proc/cpuinfo').toString().split('\n');
|
|
797
|
+
const uarch = util.getValue(linesRiscV, 'uarch') || '';
|
|
798
|
+
if (uarch.indexOf(',') > -1) {
|
|
799
|
+
const split = uarch.split(',');
|
|
800
|
+
result.manufacturer = cpuManufacturer(split[0]);
|
|
801
|
+
result.brand = split[1];
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
791
805
|
// socket type
|
|
792
806
|
let lines2 = [];
|
|
793
807
|
exec('export LC_ALL=C; dmidecode –t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL', function (error2, stdout2) {
|
package/lib/internet.js
CHANGED
|
@@ -62,52 +62,14 @@ function inetChecksite(url, callback) {
|
|
|
62
62
|
if (callback) { callback(result); }
|
|
63
63
|
return resolve(result);
|
|
64
64
|
}
|
|
65
|
-
let t = Date.now();
|
|
66
|
-
if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) {
|
|
67
|
-
let args = ['-I', '--connect-timeout', '5', '-m', '5'];
|
|
68
|
-
args.push(urlSanitized);
|
|
69
|
-
let cmd = 'curl';
|
|
70
|
-
util.execSafe(cmd, args).then((stdout) => {
|
|
71
|
-
const lines = stdout.split('\n');
|
|
72
|
-
let statusCode = lines[0] && lines[0].indexOf(' ') >= 0 ? parseInt(lines[0].split(' ')[1], 10) : 404;
|
|
73
|
-
result.status = statusCode || 404;
|
|
74
|
-
result.ok = (statusCode === 200 || statusCode === 301 || statusCode === 302 || statusCode === 304);
|
|
75
|
-
result.ms = (result.ok ? Date.now() - t : null);
|
|
76
|
-
if (callback) { callback(result); }
|
|
77
|
-
resolve(result);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
if (_windows) { // if this is stable, this can be used for all OS types
|
|
81
|
-
const http = (urlSanitized.startsWith('https:') ? require('https') : require('http'));
|
|
82
|
-
try {
|
|
83
|
-
http.get(urlSanitized, (res) => {
|
|
84
|
-
const statusCode = res.statusCode;
|
|
85
|
-
|
|
86
|
-
result.status = statusCode || 404;
|
|
87
|
-
result.ok = (statusCode === 200 || statusCode === 301 || statusCode === 302 || statusCode === 304);
|
|
88
65
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
res.on('end', () => {
|
|
97
|
-
result.ms = (result.ok ? Date.now() - t : null);
|
|
98
|
-
if (callback) { callback(result); }
|
|
99
|
-
resolve(result);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}).on('error', () => {
|
|
103
|
-
if (callback) { callback(result); }
|
|
104
|
-
resolve(result);
|
|
105
|
-
});
|
|
106
|
-
} catch (err) {
|
|
107
|
-
if (callback) { callback(result); }
|
|
108
|
-
resolve(result);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
66
|
+
util.checkWebsite(urlSanitized).then((res) => {
|
|
67
|
+
result.status = res.statusCode;
|
|
68
|
+
result.ok = res.statusCode >= 200 && res.statusCode <= 399;;
|
|
69
|
+
result.ms = (result.ok ? res.time : null);
|
|
70
|
+
if (callback) { callback(result); }
|
|
71
|
+
resolve(result);
|
|
72
|
+
});
|
|
111
73
|
} else {
|
|
112
74
|
if (callback) { callback(result); }
|
|
113
75
|
resolve(result);
|
package/lib/network.js
CHANGED
|
@@ -1544,8 +1544,11 @@ function networkConnections(callback) {
|
|
|
1544
1544
|
processes = processes.map((line => { return line.trim().replace(/ +/g, ' '); }));
|
|
1545
1545
|
let lines = stdout.toString().split('\n');
|
|
1546
1546
|
lines.shift();
|
|
1547
|
-
|
|
1548
|
-
|
|
1547
|
+
let pidPos = 8;
|
|
1548
|
+
if (lines.length > 1 && lines[0].indexOf('pid') > 0) {
|
|
1549
|
+
const header = (lines.shift() || '').replace(/ Address/g, '_Address').replace(/ +/g, ' ').split(' ');
|
|
1550
|
+
pidPos = header.indexOf('pid');
|
|
1551
|
+
}
|
|
1549
1552
|
lines.forEach(function (line) {
|
|
1550
1553
|
line = line.replace(/ +/g, ' ').split(' ');
|
|
1551
1554
|
if (line.length >= 8) {
|
package/lib/util.js
CHANGED
|
@@ -2483,6 +2483,42 @@ function getAppleModel(key) {
|
|
|
2483
2483
|
};
|
|
2484
2484
|
}
|
|
2485
2485
|
|
|
2486
|
+
function checkWebsite(url, timeout = 5000) {
|
|
2487
|
+
const http = ((url.startsWith('https:') || url.indexOf(':443/') > 0 || url.indexOf(':8443/') > 0) ? require('https') : require('http'));
|
|
2488
|
+
const t = Date.now();
|
|
2489
|
+
return new Promise((resolve) => {
|
|
2490
|
+
http
|
|
2491
|
+
.get(url, { rejectUnauthorized: false }, function (res) {
|
|
2492
|
+
res.on('data', () => { });
|
|
2493
|
+
res.on('end', () => {
|
|
2494
|
+
resolve({
|
|
2495
|
+
url,
|
|
2496
|
+
statusCode: res.statusCode,
|
|
2497
|
+
message: res.statusMessage,
|
|
2498
|
+
time: Date.now() - t
|
|
2499
|
+
});
|
|
2500
|
+
});
|
|
2501
|
+
})
|
|
2502
|
+
.on("error", function (e) {
|
|
2503
|
+
resolve({
|
|
2504
|
+
url,
|
|
2505
|
+
statusCode: 404,
|
|
2506
|
+
message: e.message,
|
|
2507
|
+
time: Date.now() - t
|
|
2508
|
+
});
|
|
2509
|
+
})
|
|
2510
|
+
.setTimeout(timeout, () => {
|
|
2511
|
+
request.close();
|
|
2512
|
+
resolve({
|
|
2513
|
+
url,
|
|
2514
|
+
statusCode: 408,
|
|
2515
|
+
message: 'Request Timeout',
|
|
2516
|
+
time: Date.now() - t
|
|
2517
|
+
});
|
|
2518
|
+
});
|
|
2519
|
+
});
|
|
2520
|
+
};
|
|
2521
|
+
|
|
2486
2522
|
function noop() { }
|
|
2487
2523
|
|
|
2488
2524
|
exports.toInt = toInt;
|
|
@@ -2536,3 +2572,4 @@ exports.WINDIR = WINDIR;
|
|
|
2536
2572
|
exports.getFilesInPath = getFilesInPath;
|
|
2537
2573
|
exports.semverCompare = semverCompare;
|
|
2538
2574
|
exports.getAppleModel = getAppleModel;
|
|
2575
|
+
exports.checkWebsite = checkWebsite;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.23.
|
|
3
|
+
"version": "5.23.19",
|
|
4
4
|
"description": "Advanced, lightweight system and OS information library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
|