Skip to content

Commit

Permalink
fix: quick but remove bssid for macOS Monterey
Browse files Browse the repository at this point in the history
  • Loading branch information
friedrith committed Oct 21, 2021
1 parent c33b4f3 commit a450bec
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
53 changes: 53 additions & 0 deletions src/macOS/scan/__test__/parser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,57 @@ describe('parse macOS scan output', () => {
}
]);
});

it('should return wifi networks on macOS Monterey', async () => {
const output = await unlog(log('scan-monterey.log'));

const networks = parse(output);

expect(networks).toEqual([
{
mac: '',
bssid: '',
ssid: 'XXXX-AMPLIFI',
channel: 36,
frequency: 5180,
quality: 38,
signal_level: '-81',
security: 'WPA2',
security_flags: ['(PSK/AES/AES)']
},
{
mac: '',
bssid: '',
ssid: 'XXXX-AMPLIFI',
channel: 36,
frequency: 5180,
quality: 70,
signal_level: '-65',
security: 'WPA2',
security_flags: ['(PSK/AES/AES)']
},
{
mac: '',
bssid: '',
ssid: 'XXXX-2.4GHz',
channel: 11,
frequency: 2462,
quality: 146,
signal_level: '-27',
security: 'WPA WPA2',
security_flags: ['(PSK/TKIP,AES/TKIP)', '(PSK/TKIP,AES/TKIP)']
},
{
mac: '',
bssid: '',
ssid: 'XXXX-5GHz',
channel: 149,
frequency: 5745,
quality: 134,
signal_level: '-33',
security: 'WPA WPA2',
security_flags: ['(PSK/TKIP,AES/TKIP)', '(PSK/TKIP,AES/TKIP)']
}
]);
});
});
4 changes: 2 additions & 2 deletions src/macOS/scan/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const parse = stdout => {
.map(line => line.trim())
.map(line => {
const match = line.match(
/(.*)\s+([a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2})\s+(-[0-9]+)\s+([0-9]+).*\s+([A-Z]+)\s+([a-zA-Z-]+)\s+([A-Z0-9(,)\s/]+)/
/(.*)\s+([a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}:[a-zA-Z0-9]{2}|)\s+(-[0-9]+)\s+([0-9]+).*\s+([A-Z]+)\s+([a-zA-Z-]+)\s+([A-Z0-9(,)\s/]+)/
);

if (match) {
Expand All @@ -54,7 +54,7 @@ const parse = stdout => {
return {
mac: bssid, // for retrocompatibility
bssid,
ssid,
ssid: ssid.trim(),
channel,
frequency: frequencyFromChannel(channel),
signal_level: rssi,
Expand Down

0 comments on commit a450bec

Please sign in to comment.