node-wifi icon indicating copy to clipboard operation
node-wifi copied to clipboard

No Error Thrown at Wrong Password

Open ofekkazes opened this issue 3 years ago • 1 comments

Hi,

First, thank you for providing this package, that easily let us communicate with the network adapters on the OS.

Expected Behavior

When using a wrong password using the connect function the function throws an error that tells us the password is incorrect.

Current Behavior

Using the package and under Windows I try to connect to a network using a bad password on "connect" function no error is thrown and the function continues as usual.

Affected features

  • node API

Possible Solution

Though I cannot identify the issue, as I could not set the profile to netsh the issue could be identified after line 68 on ../src/windows-connect.js:

.catch(err => {
      execFile(
        'netsh',
        ['wlan', 'delete', `profile "${ap.ssid}"`],
        { env },
        () => {
          callback && callback(err);
        }
      );
    });

I could not see any related err sent to the callback, just the general err, however it might had not been flagged as an error by the command line.

Context

Your Environment

  • OS: Windows 10 Pro x64
  • node-wifi version: 2.0.15
  • wifi card: Realtek RTL8822BE

ofekkazes avatar Aug 21 '21 12:08 ofekkazes

I think you pointed the good reason. Windows command line doesn't return an error when the connection failed because of wrong password. I suggest you to test the current connections just after using the function connect.

friedrith avatar Aug 23 '21 20:08 friedrith