systeminformation 5.12.10 → 5.12.11
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/index.js +0 -9
- package/lib/wifi.js +34 -37
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -159,14 +159,6 @@ function getDynamicData(srv, iface, callback) {
|
|
|
159
159
|
};
|
|
160
160
|
})();
|
|
161
161
|
|
|
162
|
-
// var totalFunctions = 14;
|
|
163
|
-
// function functionProcessed() {
|
|
164
|
-
// if (--totalFunctions === 0) {
|
|
165
|
-
// if (callback) { callback(data) }
|
|
166
|
-
// resolve(data);
|
|
167
|
-
// }
|
|
168
|
-
// }
|
|
169
|
-
|
|
170
162
|
let data = {};
|
|
171
163
|
|
|
172
164
|
// get time
|
|
@@ -342,7 +334,6 @@ function get(valueObject, callback) {
|
|
|
342
334
|
result[key] = data[i];
|
|
343
335
|
} else {
|
|
344
336
|
let keys = valueObject[key];
|
|
345
|
-
// let params = '';
|
|
346
337
|
let filter = '';
|
|
347
338
|
let filterParts = [];
|
|
348
339
|
// remove params
|
package/lib/wifi.js
CHANGED
|
@@ -125,7 +125,7 @@ function wifiChannelFromFrequencs(frequency) {
|
|
|
125
125
|
|
|
126
126
|
function ifaceListLinux() {
|
|
127
127
|
const result = [];
|
|
128
|
-
const cmd = 'iw dev';
|
|
128
|
+
const cmd = 'iw dev 2>/dev/null';
|
|
129
129
|
try {
|
|
130
130
|
const all = execSync(cmd).toString().split('\n').map(line => line.trim()).join('\n');
|
|
131
131
|
const parts = all.split('\nInterface ');
|
|
@@ -145,7 +145,30 @@ function ifaceListLinux() {
|
|
|
145
145
|
});
|
|
146
146
|
return result;
|
|
147
147
|
} catch (e) {
|
|
148
|
-
|
|
148
|
+
try {
|
|
149
|
+
const all = execSync('nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null').toString();
|
|
150
|
+
const parts = all.split('\nGENERAL.DEVICE:');
|
|
151
|
+
let i = 1;
|
|
152
|
+
parts.forEach(ifaceDetails => {
|
|
153
|
+
const lines = ifaceDetails.split('\n');
|
|
154
|
+
const iface = util.getValue(lines, 'GENERAL.DEVICE');
|
|
155
|
+
const type = util.getValue(lines, 'GENERAL.TYPE');
|
|
156
|
+
const id = i++; // // util.getValue(lines, 'GENERAL.PATH');
|
|
157
|
+
const mac = util.getValue(lines, 'GENERAL.HWADDR');
|
|
158
|
+
const channel = '';
|
|
159
|
+
if (type.toLowerCase() === 'wifi') {
|
|
160
|
+
result.push({
|
|
161
|
+
id,
|
|
162
|
+
iface,
|
|
163
|
+
mac,
|
|
164
|
+
channel
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return result;
|
|
169
|
+
} catch (e) {
|
|
170
|
+
return [];
|
|
171
|
+
}
|
|
149
172
|
}
|
|
150
173
|
}
|
|
151
174
|
|
|
@@ -244,8 +267,8 @@ function getWifiNetworkListIw(iface) {
|
|
|
244
267
|
if (iwlistParts[0].indexOf('resource busy') >= 0) { return -1; }
|
|
245
268
|
if (iwlistParts.length > 1) {
|
|
246
269
|
iwlistParts.shift();
|
|
247
|
-
|
|
248
|
-
const lines =
|
|
270
|
+
iwlistParts.forEach(element => {
|
|
271
|
+
const lines = element.split('\n');
|
|
249
272
|
const channel = util.getValue(lines, 'channel', ':', true);
|
|
250
273
|
const address = (lines && lines.length && lines[0].indexOf('Address:') >= 0 ? lines[0].split('Address:')[1].trim().toLowerCase() : '');
|
|
251
274
|
const mode = util.getValue(lines, 'mode', ':', true);
|
|
@@ -257,8 +280,8 @@ function getWifiNetworkListIw(iface) {
|
|
|
257
280
|
const ssid = util.getValue(lines, 'essid', ':', true);
|
|
258
281
|
|
|
259
282
|
// security and wpa-flags
|
|
260
|
-
const isWpa =
|
|
261
|
-
const isWpa2 =
|
|
283
|
+
const isWpa = element.indexOf(' WPA ') >= 0;
|
|
284
|
+
const isWpa2 = element.indexOf('WPA2 ') >= 0;
|
|
262
285
|
const security = [];
|
|
263
286
|
if (isWpa) { security.push('WPA'); }
|
|
264
287
|
if (isWpa2) { security.push('WPA2'); }
|
|
@@ -307,7 +330,7 @@ function getWifiNetworkListIw(iface) {
|
|
|
307
330
|
wpaFlags,
|
|
308
331
|
rsnFlags: []
|
|
309
332
|
});
|
|
310
|
-
}
|
|
333
|
+
});
|
|
311
334
|
}
|
|
312
335
|
return result;
|
|
313
336
|
} catch (e) {
|
|
@@ -315,30 +338,6 @@ function getWifiNetworkListIw(iface) {
|
|
|
315
338
|
}
|
|
316
339
|
}
|
|
317
340
|
|
|
318
|
-
/*
|
|
319
|
-
ssid: line.substring(parsedhead[0].from, parsedhead[0].to).trim(),
|
|
320
|
-
bssid: line.substring(parsedhead[1].from, parsedhead[1].to).trim().toLowerCase(),
|
|
321
|
-
mode: '',
|
|
322
|
-
channel,
|
|
323
|
-
frequency: wifiFrequencyFromChannel(channel),
|
|
324
|
-
signalLevel: signalLevel ? parseInt(signalLevel, 10) : null,
|
|
325
|
-
quality: wifiQualityFromDB(signalLevel),
|
|
326
|
-
security,
|
|
327
|
-
wpaFlags,
|
|
328
|
-
rsnFlags: []
|
|
329
|
-
|
|
330
|
-
const securityAll = line.substring(parsedhead[6].from, 1000).trim().split(' ');
|
|
331
|
-
let security = [];
|
|
332
|
-
let wpaFlags = [];
|
|
333
|
-
securityAll.forEach(securitySingle => {
|
|
334
|
-
if (securitySingle.indexOf('(') > 0) {
|
|
335
|
-
const parts = securitySingle.split('(');
|
|
336
|
-
security.push(parts[0]);
|
|
337
|
-
wpaFlags = wpaFlags.concat(parts[1].replace(')', '').split(','));
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
*/
|
|
342
341
|
function parseWifiDarwin(wifiObj) {
|
|
343
342
|
const result = [];
|
|
344
343
|
if (wifiObj) {
|
|
@@ -392,11 +391,11 @@ function wifiNetworks(callback) {
|
|
|
392
391
|
try {
|
|
393
392
|
const iwconfigParts = execSync('export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL').toString().split('\n\n');
|
|
394
393
|
let iface = '';
|
|
395
|
-
|
|
396
|
-
if (
|
|
397
|
-
iface =
|
|
394
|
+
iwconfigParts.forEach(element => {
|
|
395
|
+
if (element.indexOf('no wireless') === -1 && element.trim() !== '') {
|
|
396
|
+
iface = element.split(' ')[0];
|
|
398
397
|
}
|
|
399
|
-
}
|
|
398
|
+
});
|
|
400
399
|
if (iface) {
|
|
401
400
|
const res = getWifiNetworkListIw(iface);
|
|
402
401
|
if (res === -1) {
|
|
@@ -574,7 +573,6 @@ function wifiConnections(callback) {
|
|
|
574
573
|
const rssi = util.toInt(util.getValue(lines2, 'agrCtlRSSI', ':', true));
|
|
575
574
|
const noise = util.toInt(util.getValue(lines2, 'agrCtlNoise', ':', true));
|
|
576
575
|
const signalLevel = rssi - noise;
|
|
577
|
-
// const signal = wifiQualityFromDB(signalLevel);
|
|
578
576
|
if (ssid || bssid) {
|
|
579
577
|
result.push({
|
|
580
578
|
id: 'Wi-Fi',
|
|
@@ -589,7 +587,6 @@ function wifiConnections(callback) {
|
|
|
589
587
|
signalLevel,
|
|
590
588
|
txRate
|
|
591
589
|
});
|
|
592
|
-
|
|
593
590
|
}
|
|
594
591
|
}
|
|
595
592
|
if (callback) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.11",
|
|
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)",
|