friedrith / node-wifi

📶 NodeJS tool to manage wifi (connections, scans)
MIT License
397 stars 161 forks source link

returning SSID without space. #5

Closed DaniyalGeek closed 7 years ago

DaniyalGeek commented 7 years ago

when i request for available wifi networks than package exclude space in SSID.

i can't understand why you do this scanResults = scanResults.toString('utf8').split(' ').join('').split('\n');

can you explain?

friedrith commented 7 years ago

This line has beed written by an intern. Yes indeed it is quite weird. Maybe it is because there are space between and after SSID. Regex would be better.

friedrith commented 7 years ago

On linux the stdout of nmcli looks like :

*:                                       
DBUS-PATH:                              /org/freedesktop/NetworkManager/AccessPoint/1095
SSID:                                   Livebox-01ED
SSID-HEX:                               4C697665626F782D30314544
BSSID:                                  30:7C:B2:18:01:ED
MODE:                                   Infra
CHAN:                                   6
FREQ:                                   2437 MHz
RATE:                                   54 Mbit/s
SIGNAL:                                 35
BARS:                                   â–‚â–„__
SECURITY:                               WPA1 WPA2
WPA-FLAGS:                              pair_tkip pair_ccmp group_tkip psk
RSN-FLAGS:                              pair_tkip pair_ccmp group_tkip psk
DEVICE:                                 wlp1s0
ACTIVE:                                 no
*:                                       
DBUS-PATH:                              /org/freedesktop/NetworkManager/AccessPoint/1068
SSID:                                   SFR_B5C0
SSID-HEX:                               5346525F42354330
BSSID:                                  24:95:04:99:B5:C4
MODE:                                   Infra
CHAN:                                   1
FREQ:                                   2412 MHz
RATE:                                   54 Mbit/s
SIGNAL:                                 29
BARS:                                   â–‚___
SECURITY:                               WPA1
WPA-FLAGS:                              pair_tkip pair_ccmp group_tkip psk
RSN-FLAGS:                              (none)
DEVICE:                                 wlp1s0
ACTIVE:                                 no
*:                                       
DBUS-PATH:                              /org/freedesktop/NetworkManager/AccessPoint/1096

So there are spaces between labels and values. Regex would definitively be better

friedrith commented 7 years ago

Ok the correction is now effective in the version of node-wifi on npm. Thanks for the help.

DaniyalGeek commented 7 years ago

Thanks On Jan 15, 2017, at 3:17 PM, Thibault Friedrich notifications@github.com<mailto:notifications@github.com> wrote:

Ok the correction is now effective in the version of node-wifi on npm. Thanks for the help.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/elqui-app/node-wifi/issues/5#issuecomment-272685969, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APiuS8N7ywTZAd3MMDaZweC2q2VlGG4Nks5rSfIqgaJpZM4LVW4T.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.