Skip to content

[Bug]: Wrong data returns for getCurrentConnections on windows 11 #184

@mussacharles60

Description

@mussacharles60

Expected behavior

I have tested on windows 11 to get the current wifi connections but wrong data returns probably indexing the rows from exec results

OS Name: Microsoft Windows 11 Pro
OS Version: 10.0.22000 N/A Build 22000

I tried to check directly via command line

C:\Users\Mussa Charles>Netsh WLAN show interfaces

There is 1 interface on the system:

    Name                   : WiFi
    Description            : Broadcom BCM00000 802.11 bgn Wi-Fi M.2 Adapter
    GUID                   : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    Physical address       : 44:xx:xx:xx:xx:xx
    Interface type         : Primary
    State                  : connected
    SSID                   : my-wifi-ssid-here
    BSSID                  : 60:xx:xx:xx:xx:xx
    Network type           : Infrastructure
    Radio type             : 802.11n
    Authentication         : WPA2-Personal
    Cipher                 : CCMP
    Connection mode        : Auto Connect
    Band                   : 2.4 GHz
    Channel                : 7
    Receive rate (Mbps)    : 72
    Transmit rate (Mbps)   : 72
    Signal                 : 86%
    Profile                : my-wifi-ssid-here

    Hosted network status  : Not available

Current behavior

With getCurrentConnections method this is what I get

const wifi = require('node-wifi');
wifi.init({ iface: null });
wifi.getCurrentConnections((error, currentConnections) => {
// ...
});

// results
[
  {
    iface: 'WiFi',
    ssid: 'connected',
    bssid: 'my-wifi-ssid-here',
    mac: 'my-wifi-ssid-here',
    mode: '60:xx:xx:xx:xx:xx',
    channel: NaN,
    frequency: NaN,
    signal_level: -64,
    quality: 72,
    security: '802.11n',
    security_flags: 'WPA2-Personal'
  }
]

As you can see from ssid to mode there are wrong data compared to the directly get from command line interface.

Which are the affected features

  • node API
  • CLI

Which is your operating system?

Windows

Environment

electron

Version of node-wifi

2.0.16

Steps to Reproduce

Install node-wifi v2.0.16

npm i [email protected]

Import node-wifi to project

const wifi = require('node-wifi');
wifi.init({ iface: null });

// get current connections
wifi.getCurrentConnections((error, currentConnections) => {
// ...
});

Solutions

It should be fixed by indexing the correct data from exec results, like at the expected behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions