systeminformation
Advanced tools
Comparing version 5.23.16 to 5.23.17
131
lib/wifi.js
@@ -179,3 +179,3 @@ 'use strict'; | ||
function nmiDeviceLinux(iface) { | ||
const cmd = `nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${iface} 2>/dev/null`; | ||
const cmd = `nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${iface} 2> /dev/null`; | ||
try { | ||
@@ -649,81 +649,58 @@ const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); | ||
} else if (_darwin) { | ||
let cmd = 'system_profiler SPNetworkDataType'; | ||
let cmd = 'system_profiler SPNetworkDataType SPAirPortDataType -xml 2>/dev/null; echo "######" ; ioreg -n AppleBCMWLANSkywalkInterface -r 2>/dev/null'; | ||
exec(cmd, function (error, stdout) { | ||
const parts1 = stdout.toString().split('\n\n Wi-Fi:\n\n'); | ||
if (parts1.length > 1) { | ||
const lines = parts1[1].split('\n\n')[0].split('\n'); | ||
const iface = util.getValue(lines, 'BSD Device Name', ':', true); | ||
const model = util.getValue(lines, 'hardware', ':', true); | ||
cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I 2>/dev/null; echo "######" ; ioreg -n AppleBCMWLANSkywalkInterface -r 2>/dev/null'; | ||
exec(cmd, function (error, stdout) { | ||
const parts = stdout.toString().split('######'); | ||
const lines2 = parts[0].split('\n'); | ||
let lines3 = []; | ||
if (parts[1].indexOf(' | {') > 0 && parts[1].indexOf(' | }') > parts[1].indexOf(' | {')) { | ||
lines3 = parts[1].split(' | {')[1].split(' | }')[0].replace(/ \| /g, '').replace(/"/g, '').split('\n'); | ||
} | ||
if (lines2.length > 10) { | ||
const ssid = util.getValue(lines2, 'ssid', ':', true); | ||
const bssid = util.getValue(lines2, 'bssid', ':', true) || formatBssid(util.getValue(lines3, 'IO80211BSSID', '=', true)); | ||
const security = util.getValue(lines2, 'link auth', ':', true); | ||
const txRate = util.getValue(lines2, 'lastTxRate', ':', true); | ||
const channel = util.getValue(lines2, 'channel', ':', true).split(',')[0]; | ||
const type = '802.11'; | ||
const rssi = util.toInt(util.getValue(lines2, 'agrCtlRSSI', ':', true)); | ||
/// const noise = util.toInt(util.getValue(lines2, 'agrCtlNoise', ':', true)); | ||
const signalLevel = rssi; | ||
if (ssid || bssid) { | ||
result.push({ | ||
id: 'Wi-Fi', | ||
iface, | ||
model, | ||
ssid, | ||
bssid, | ||
channel: util.toInt(channel), | ||
frequency: channel ? wifiFrequencyFromChannel(channel) : null, | ||
type, | ||
security, | ||
signalLevel, | ||
quality: wifiQualityFromDB(signalLevel), | ||
txRate | ||
}); | ||
} | ||
} | ||
if (lines3.length > 10) { | ||
const ssid = util.getValue(lines3, 'IO80211SSID', '=', true); | ||
const bssid = formatBssid(util.getValue(lines3, 'IO80211BSSID', '=', true)); | ||
const security = ''; | ||
const txRate = -1; | ||
const signalLevel = -1; | ||
const quality = -1; | ||
const channel = util.getValue(lines3, 'IO80211Channel', '=', true); | ||
const type = '802.11'; | ||
if ((ssid || bssid) && !result.length) { | ||
result.push({ | ||
id: 'Wi-Fi', | ||
iface, | ||
model, | ||
ssid, | ||
bssid, | ||
channel: util.toInt(channel), | ||
frequency: channel ? wifiFrequencyFromChannel(channel) : null, | ||
type, | ||
security, | ||
signalLevel, | ||
quality, | ||
txRate | ||
}); | ||
} | ||
} | ||
if (callback) { | ||
callback(result); | ||
} | ||
resolve(result); | ||
try { | ||
const parts = stdout.toString().split('######'); | ||
const profilerObj = util.plistParser(parts[0]); | ||
const networkObj = profilerObj[0]._SPCommandLineArguments.indexOf('SPNetworkDataType') >= 0 ? profilerObj[0]._items : profilerObj[1]._items; | ||
const airportObj = profilerObj[0]._SPCommandLineArguments.indexOf('SPAirPortDataType') >= 0 ? profilerObj[0]._items[0].spairport_airport_interfaces : profilerObj[1]._items[0].spairport_airport_interfaces; | ||
// parts[1] : ioreg | ||
let lines3 = []; | ||
if (parts[1].indexOf(' | {') > 0 && parts[1].indexOf(' | }') > parts[1].indexOf(' | {')) { | ||
lines3 = parts[1].split(' | {')[1].split(' | }')[0].replace(/ \| /g, '').replace(/"/g, '').split('\n'); | ||
} | ||
const networkWifiObj = networkObj.find((item) => { return item._name === 'Wi-Fi'; }); | ||
const airportWifiObj = airportObj[0].spairport_current_network_information; | ||
const channel = parseInt(('' + airportWifiObj.spairport_network_channel).split(' ')[0]) || 0; | ||
const signalLevel = airportWifiObj.spairport_signal_noise || null; | ||
let security = []; | ||
const sm = airportWifiObj.spairport_security_mode; | ||
if (sm === 'spairport_security_mode_wep') { | ||
security.push('WEP'); | ||
} else if (sm === 'spairport_security_mode_wpa2_personal') { | ||
security.push('WPA2'); | ||
} else if (sm.startsWith('spairport_security_mode_wpa2_enterprise')) { | ||
security.push('WPA2 EAP'); | ||
} else if (sm.startsWith('pairport_security_mode_wpa3_transition')) { | ||
security.push('WPA2/WPA3'); | ||
} else if (sm.startsWith('pairport_security_mode_wpa3')) { | ||
security.push('WPA3'); | ||
} | ||
result.push({ | ||
id: networkWifiObj._name || 'Wi-Fi', | ||
iface: networkWifiObj.interface || '', | ||
model: networkWifiObj.hardware || '', | ||
ssid: airportWifiObj._name || '', | ||
bssid: airportWifiObj.spairport_network_bssid || '', | ||
channel, | ||
frequency: channel ? wifiFrequencyFromChannel(channel) : null, | ||
type: airportWifiObj.spairport_network_phymode || '802.11', | ||
security, | ||
signalLevel: signalLevel ? parseInt(signalLevel, 10) : null, | ||
quality: wifiQualityFromDB(signalLevel), | ||
txRate: airportWifiObj.spairport_network_rate || null, | ||
}); | ||
} else { | ||
if (callback) { | ||
callback(result); | ||
} | ||
resolve(result); | ||
} catch (e) { | ||
util.noop(); | ||
} | ||
if (callback) { | ||
callback(result); | ||
} | ||
resolve(result); | ||
}); | ||
@@ -730,0 +707,0 @@ } else if (_windows) { |
{ | ||
"name": "systeminformation", | ||
"version": "5.23.16", | ||
"version": "5.23.17", | ||
"description": "Advanced, lightweight system and OS information library", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
773531
17046