From 373b552c174ac93d90f860bcb385fd2691be06e6 Mon Sep 17 00:00:00 2001 From: Sora Morimoto Date: Tue, 24 Dec 2024 10:35:22 +0900 Subject: [PATCH] Prepare 3.2.0 Signed-off-by: Sora Morimoto --- dist/index.js | 147 ++++++++++++------------------ dist/post/index.js | 147 ++++++++++++------------------ package.json | 2 +- packages/setup-ocaml/package.json | 2 +- yarn.lock | 10 +- 5 files changed, 125 insertions(+), 183 deletions(-) diff --git a/dist/index.js b/dist/index.js index b58b3224..62746316 100644 --- a/dist/index.js +++ b/dist/index.js @@ -96065,7 +96065,7 @@ function networkConnections(callback) { }); } if (_darwin) { - let cmd = 'netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"'; + let cmd = 'netstat -natvln | head -n2; netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"'; const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT_1|FIN_WAIT2|FIN_WAIT_2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN'.split('|'); exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { if (!error) { @@ -96073,15 +96073,9 @@ function networkConnections(callback) { let processes = stdout2.toString().split('\n'); processes = processes.map((line => { return line.trim().replace(/ +/g, ' '); })); let lines = stdout.toString().split('\n'); - let pidPos = 8; - if (lines[0] !== '') { - const lineParts = lines[0].replace(/ +/g, ' ').split(' '); - for (let i = 0; i < lineParts.length; i++) { - if (states.indexOf(lineParts[i]) >= 0) { - pidPos = i + 3; - } - }; - } + lines.shift(); + const header = lines.shift().replace(/ Address/g, '_Address').replace(/ +/g, ' ').split(' '); + let pidPos = header.indexOf('pid'); lines.forEach(function (line) { line = line.replace(/ +/g, ' ').split(' '); if (line.length >= 8) { @@ -103306,7 +103300,7 @@ function ifaceListLinux() { } 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 { const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); const ssid = util.getValue(lines, 'GENERAL.CONNECTION'); @@ -103775,85 +103769,62 @@ function wifiConnections(callback) { } resolve(result); } 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); - }); - } else { - if (callback) { - callback(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'); } - resolve(result); + + 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, + }); + + } catch (e) { + util.noop(); + } + if (callback) { + callback(result); } + resolve(result); }); } else if (_windows) { let cmd = 'netsh wlan show interfaces'; @@ -148087,7 +148058,7 @@ module.exports = /*#__PURE__*/JSON.parse('[["0","\\u0000",128],["a1","。",62],[ /***/ 15460: /***/ ((module) => { -module.exports = {"rE":"5.23.16"}; +module.exports = {"rE":"5.23.17"}; /***/ }), diff --git a/dist/post/index.js b/dist/post/index.js index 580a8163..f253e26b 100644 --- a/dist/post/index.js +++ b/dist/post/index.js @@ -61889,7 +61889,7 @@ function networkConnections(callback) { }); } if (_darwin) { - let cmd = 'netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"'; + let cmd = 'netstat -natvln | head -n2; netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"'; const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT_1|FIN_WAIT2|FIN_WAIT_2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN'.split('|'); exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { if (!error) { @@ -61897,15 +61897,9 @@ function networkConnections(callback) { let processes = stdout2.toString().split('\n'); processes = processes.map((line => { return line.trim().replace(/ +/g, ' '); })); let lines = stdout.toString().split('\n'); - let pidPos = 8; - if (lines[0] !== '') { - const lineParts = lines[0].replace(/ +/g, ' ').split(' '); - for (let i = 0; i < lineParts.length; i++) { - if (states.indexOf(lineParts[i]) >= 0) { - pidPos = i + 3; - } - }; - } + lines.shift(); + const header = lines.shift().replace(/ Address/g, '_Address').replace(/ +/g, ' ').split(' '); + let pidPos = header.indexOf('pid'); lines.forEach(function (line) { line = line.replace(/ +/g, ' ').split(' '); if (line.length >= 8) { @@ -69130,7 +69124,7 @@ function ifaceListLinux() { } 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 { const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); const ssid = util.getValue(lines, 'GENERAL.CONNECTION'); @@ -69599,85 +69593,62 @@ function wifiConnections(callback) { } resolve(result); } 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); - }); - } else { - if (callback) { - callback(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'); } - resolve(result); + + 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, + }); + + } catch (e) { + util.noop(); + } + if (callback) { + callback(result); } + resolve(result); }); } else if (_windows) { let cmd = 'netsh wlan show interfaces'; @@ -113268,7 +113239,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4. /***/ 15460: /***/ ((module) => { -module.exports = {"rE":"5.23.16"}; +module.exports = {"rE":"5.23.17"}; /***/ }) diff --git a/package.json b/package.json index a082439a..2894d31e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setup-ocaml", - "version": "3.1.6", + "version": "3.2.0", "private": true, "type": "module", "workspaces": [ diff --git a/packages/setup-ocaml/package.json b/packages/setup-ocaml/package.json index 512d9587..6a0b107b 100644 --- a/packages/setup-ocaml/package.json +++ b/packages/setup-ocaml/package.json @@ -19,7 +19,7 @@ "@actions/tool-cache": "2.0.1", "cheerio": "1.0.0", "semver": "7.6.3", - "systeminformation": "5.23.16", + "systeminformation": "5.23.17", "yaml": "2.6.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index d785e426..41eed557 100644 --- a/yarn.lock +++ b/yarn.lock @@ -509,7 +509,7 @@ __metadata: "@vercel/ncc": "npm:0.38.3" cheerio: "npm:1.0.0" semver: "npm:7.6.3" - systeminformation: "npm:5.23.16" + systeminformation: "npm:5.23.17" typescript: "npm:5.7.2" yaml: "npm:2.6.1" languageName: unknown @@ -1900,12 +1900,12 @@ __metadata: languageName: node linkType: hard -"systeminformation@npm:5.23.16": - version: 5.23.16 - resolution: "systeminformation@npm:5.23.16" +"systeminformation@npm:5.23.17": + version: 5.23.17 + resolution: "systeminformation@npm:5.23.17" bin: systeminformation: lib/cli.js - checksum: 10c0/ef35da22cc1a71626c2904e49f549ca68c063fb00d5024675e80c3f897c82c54b73d61f761f0300f89509495cfe5c9cce3811738572ab10382017375fce1d858 + checksum: 10c0/def66c091be863c89fe9bdcf7880ba8d85a24ebafd68b6acadaac9bd1988831f6f6b5b91cc38767eb3b0ae1e298e5c4e0f9932999521d9df53d4c08f7e2d1a34 conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android) languageName: node linkType: hard