Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
mussacharles60 opened this issue Nov 11, 2022 · 3 comments
Open
2 tasks done

Comments

@mussacharles60
Copy link

mussacharles60 commented Nov 11, 2022

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

@JordanPFVR
Copy link

Still appears to be an issue.

@eltoroit
Copy link

eltoroit commented Sep 1, 2023

The problem is that the code is assuming the fields are always shown in the same order. This function would need to be rewritten in a more generic form.

@eltoroit
Copy link

eltoroit commented Sep 2, 2023

I have proposed a change to the code that fixes this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants