You are not logged in.

#1 2009-01-27 15:19:51

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

wifi-select: for selecting wifi network from console (based on netcfg)

Hi all!

I'm happy to announce new 'wifi-select' tool for selecting networks "in real-time" (in NetworkManager manner). I heard on the forums there were requests for such a tool from the users of netcfg. The tool is convinient for use in wifi-cafe or another places you are visiting first (and maybe last) time. Then you don't need to create the file-profile for a new network, just type 'sudo wifi-select eth1' and choose the network you need.

It works as follows:
- parses 'iwlist scan' and presents list of networks along with its security settings (wpa/wep/none) using 'dialog'.
- if user selects network with existing profile -- just use this profile to connect with 'netcfg'.
- if user selects a new network (for example network from wifi-cafe he currently visited), net-select automatically generates new profile with corresponding $SECURITY and asks for the key (if needed). It uses DHCP as $IP by default.
- then, if connection succeeds, profile is saved for later usage.
- if connection fails, user is asked if he/she wants to keep generated profile for further usage (for example to change $IP to static or adjust some additional options).

Parsing of 'iwlist' output is done using AWK script (this seems to be clearer than grep+sed in my case). I've put it under /usr/lib/network (where netcfg .subr-files are located).

I sent the scripts to James Rayner aka iphitus (maintainer of netcfg), he was interested and suggested to package the tool in AUR and if there would be some attention and interest -- he would package it in extra.

UPDATE
The tool is currently packaged and available in [community] (pacman -S wifi-select).
The main dev repository is on GitHub: https://github.com/sphynx/wifi-select

So, I'm waiting for your feedback and questions.

Thank you!

Last edited by dying_sphynx (2011-11-25 15:28:18)


With best regards,
Ivan N. Veselov.

Offline

#2 2009-01-27 16:40:40

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

The only downfall I see with this is that it will not show networks that are hidden.  This is the one thing that I'd love with netcfg because then it truly could roam without user interaction.  Certainly nice work though.  Thanks.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#3 2009-01-27 17:05:55

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

rson451 wrote:

The only downfall I see with this is that it will not show networks that are hidden.  This is the one thing that I'd love with netcfg because then it truly could roam without user interaction.

Thank you for the answer!

Yeah, but you can still use plain 'netcfg' if you know this hidden ESSID. Although this feature might be added in future releases if really needed (I mean asking for a ESSID for hidden network if it is specified as <hidden> in `iwlist scan` result).


With best regards,
Ivan N. Veselov.

Offline

#4 2009-01-28 13:13:03

mmmasterluke
Member
Registered: 2007-12-07
Posts: 49

Re: wifi-select: for selecting wifi network from console (based on netcfg)

Thanks for this little tool. Personally, I can see how I'd use it from time to time.

I only had little time to play with it so far, though. I disconnected my wifi connection and ran the tool. Then I selected my home network but then I was asked for the pass phrase. In my opinion, it would be very handy if the pass phrases for known networks could be read from the config files in /etc/network.d/.

Offline

#5 2009-01-28 13:42:09

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

mmmasterluke wrote:

Thanks for this little tool. Personally, I can see how I'd use it from time to time.

You are welcome!

mmmasterluke wrote:

I only had little time to play with it so far, though. I disconnected my wifi connection and ran the tool. Then I selected my home network but then I was asked for the pass phrase. In my opinion, it would be very handy if the pass phrases for known networks could be read from the config files in /etc/network.d/.

Yeah, it should read it from config already, the only thing is that network file has to be named according to its ESSID. So if your network ESSID is "MyNet" -- wifi-select tries to find the file /etc/network.d/MyNet to get the settings (key, etc.). This assumption makes things easier, so I decided to not look inside all network.d/* files to find all known network ESSIDs.


With best regards,
Ivan N. Veselov.

Offline

#6 2009-01-29 13:08:07

evol
Member
From: Ireland
Registered: 2007-06-27
Posts: 53
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

This is a brilliant piece of work, thank you!


-//------------------/------>

Offline

#7 2009-01-29 13:13:12

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: wifi-select: for selecting wifi network from console (based on netcfg)

Great little app, gonna download right away smile

Offline

#8 2009-01-29 14:48:04

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

evol, Runiq,
Thank you and please do not forget to post your usage experience and any found bugs or issues (and vote on AUR as well, if you like wifi-select smile)


With best regards,
Ivan N. Veselov.

Offline

#9 2009-01-29 17:42:00

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

Great script! I have it tied to a keyboard shortcut so it just pops open a terminal (added wifi-select to sudoer's file) and brings up a list of networks. Awesome!  Only tried it at home and work so far (WPA and unencrypted) on networks I already know I can get on. No new networks to this machine have been tested yet.

Thanks a bunch!!
Scott

Offline

#10 2009-01-29 23:53:39

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

firecat53 wrote:

Great script! I have it tied to a keyboard shortcut so it just pops open a terminal (added wifi-select to sudoer's file) and brings up a list of networks. Awesome!  Only tried it at home and work so far (WPA and unencrypted) on networks I already know I can get on. No new networks to this machine have been tested yet.

Thank you for such a pleasant feedback, Scott!

You can easily test connection from scratch and creation of new configs for the new networks by creating a backup of your hand-created profiles for home and work and further removing it from /etc/network.d. After this you can try to connect from scratch to these networks using wifi-select. If all is OK -- you might want to restore the profiles from the backup (if you have some specific options or quirks there) or leave the generated ones. If something goes wrong -- please post your experience.

Last edited by dying_sphynx (2009-02-02 21:07:26)


With best regards,
Ivan N. Veselov.

Offline

#11 2009-01-30 00:34:00

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

I'm not sure if this would be a bug or a feature, but if the interface (wlan0) is down (which happens occasionally if it doesn't connect...dhcp lease failure... to the wireless network, netcfg ends up with the interface down), wifi-select will fail. I got around this by adding 'sudo ifconfig wlan0 up' before any calls to wifi-select in my keyboard shortcuts.

Thanks!
Scott

Offline

#12 2009-01-31 06:16:51

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

I do have one suggestion as added feature:
  Add a list directly above or below the network list that contains existing user-created (not wifi-select created) netcfg profiles. This way, people can switch between home and work networks easily, and retain any specialized network settings in the profile. I suppose negcfg-auto-wireless sort of provides this, but it would be nice to see them all in the same place.

Thanks!
Scott

Offline

#13 2009-01-31 10:10:46

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

firecat53 wrote:

but if the interface (wlan0) is down (which happens occasionally if it doesn't connect...dhcp lease failure... to the wireless network, netcfg ends up with the interface down), wifi-select will fail.

What do you mea by failing wifi-select? Is it related to underlying netcfg failure? wifi-select just finishes with calling 'netcfg some_network' at the end of preparing work (general schema is: ask user, create profiles if necessary, run netcfg).

I got around this by adding 'sudo ifconfig wlan0 up' before any calls to wifi-select in my keyboard shortcuts.

Well, if this does help you -- it's great! smile


With best regards,
Ivan N. Veselov.

Offline

#14 2009-01-31 10:18:16

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

firecat53 wrote:

I do have one suggestion as added feature:
  Add a list directly above or below the network list that contains existing user-created (not wifi-select created) netcfg profiles. This way, people can switch between home and work networks easily, and retain any specialized network settings in the profile. I suppose negcfg-auto-wireless sort of provides this, but it would be nice to see them all in the same place.

What do you think about marking these networks in list somehow?
For example:
! - if there is a handmade profile for this network
* - if there is a autogenerated profile for this network
  - if there are no profiles for this network

I think the distinction between generated and handmade profiles could be made based on some comment or profile description (it is set to "Automatically generated profile" by wifi-select in the generation process. And if after changes this description -- profile would be considered handmade).

Last edited by dying_sphynx (2009-02-02 21:07:44)


With best regards,
Ivan N. Veselov.

Offline

#15 2009-01-31 17:14:30

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

What do you mean by failing wifi-select?

If the interface (wlan0, eth0, etc) is down, 'wifi-select wlan0' will not return any results "> no networks found". I guess in order to make it function from a keyboard shortcut no matter what state the interface is in, you either have to add that functionality (bringing the interface up) to wifi-select, or add it to your keyboard shortcut, as I did.

You could even add a 'wired' profile to bring up eth0 if you are plugged in and don't want to use ifplugd.

Marking the networks/profiles in the list would probably work fine.

Thanks!
Scott

Offline

#16 2009-02-01 14:42:27

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

firecat53 wrote:

If the interface (wlan0, eth0, etc) is down, 'wifi-select wlan0' will not return any results "> no networks found". I guess in order to make it function from a keyboard shortcut no matter what state the interface is in, you either have to add that functionality (bringing the interface up) to wifi-select, or add it to your keyboard shortcut, as I did.

I think it is somehow related to only your wireless driver and can be fixed by adding netcfg "quirks", because I've tried it on my system (explicitly put the interface down with 'ifconfig eth1 down', then run 'wifi-select eth1' and yeah! - I am connected to network without any explicit bringing the interface up.

You could even add a 'wired' profile to bring up eth0 if you are plugged in and don't want to use ifplugd.

I don't think wifi-select should deal with ethernet interfaces, ESSIDs in the list are only wireless networks retrieved by 'iwlist scan'.

Marking the networks/profiles in the list would probably work fine.

I've finished this and uploaded a new version of the package to AUR, please update and tell me how do you like this marking smile

Last edited by dying_sphynx (2009-02-02 21:08:01)


With best regards,
Ivan N. Veselov.

Offline

#17 2009-02-01 18:06:22

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

Upgraded wifi-select, but it doesn't recognize my pre-existing profiles (the ones I had before wifi-select). I had one called station1 and one called home located in /etc/network.d/. I see the ones that wifi-select has created in /etc/network.d, but not my handmade ones. Is it supposed to register the pre-existing profiles there?

Thanks!
Scott

Offline

#18 2009-02-02 11:34:40

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

firecat53 wrote:

Upgraded wifi-select, but it doesn't recognize my pre-existing profiles (the ones I had before wifi-select). I had one called station1 and one called home located in /etc/network.d/. I see the ones that wifi-select has created in /etc/network.d, but not my handmade ones. Is it supposed to register the pre-existing profiles there?

Currently wifi-select assumes that file in /etc/network.d describing profile must be named after its network ESSID, so if you have profile named 'station1' but its ESSID is for example 'Station1net' - wifi-select does not recognize that profile for \Station1net' already exists. So I have a question: do your profile name and ESSID differ?

This wifi-select assumption is a bit confusing and I think I have to fix this (this was done in such a way just to simplify parsing and because my profiles are named after ESSIds smile). But now I'm sharing this script so it's time to fix.

Last edited by dying_sphynx (2009-02-02 21:08:17)


With best regards,
Ivan N. Veselov.

Offline

#19 2009-02-02 21:01:42

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

I named my profiles differently than the essid, just to be more descriptive. Also, there are a lot of networks with essid 'default' or 'dd-wrt' out there, so it helps to avoid confusion, IMO.

Thanks!
Scott

Offline

#20 2009-02-02 21:22:58

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

firecat53 wrote:

I named my profiles differently than the essid, just to be more descriptive. Also, there are a lot of networks with essid 'default' or 'dd-wrt' out there, so it helps to avoid confusion, IMO

Sure thing, you are right. Please check the latest 0.7 version: I've fixed this issue (profile names are no more restricted to be named after essids) and also included explicit bringing up of the interface, so now you could remove this from your wifi-select invocation. Please share your further suggestions and feedback! Thanks!


With best regards,
Ivan N. Veselov.

Offline

#21 2009-02-03 23:51:09

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

It  (0.7) still doesn't list my pre-existing profiles from /etc/network.d. If I understand you correctly, wifi-select should list ALL profiles contained within /etc/network.d, regardless of their source (ie handmade or automatically generated)?

Thanks!
Scott

Offline

#22 2009-02-04 08:26:29

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

firecat53 wrote:

If I understand you correctly, wifi-select should list ALL profiles contained within /etc/network.d

No, it shouldn't. Wifi-select lists all the essids physically available at the moment in a given location. So if you are at home - it doesn't make sense to show you the work profile and vice versa. I'd like to stress that initially it uses 'iwlist scan' results, so just show essids found in networks scan process which are available to connect. It's the way many "wifi-connectors" work (NetworkManager, etc.) and which I was missing with pure netcfg.

If you want just to list all your created profiles regardless theirs availability - you should use netcfg-menu then.

Last edited by dying_sphynx (2009-02-04 08:27:09)


With best regards,
Ivan N. Veselov.

Offline

#23 2009-03-04 16:44:57

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: wifi-select: for selecting wifi network from console (based on netcfg)

Awesome tool! If you want it put into community, let me know and I'll be glad to adopt it on AUR.

Also, if you do end up making it so that it can scan all netcfg profiles for a match, look for a match based on MAC address of the router, not the ESSID, if that's possible...

Last edited by Daenyth (2009-03-04 16:46:02)

Offline

#24 2009-03-04 17:52:23

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: wifi-select: for selecting wifi network from console (based on netcfg)

Daenyth wrote:

Also, if you do end up making it so that it can scan all netcfg profiles for a match, look for a match based on MAC address of the router, not the ESSID, if that's possible...

I'd like that too if it isn't asking for too much. smile

Offline

#25 2009-03-08 15:11:30

dying_sphynx
Member
From: Kiev, Ukraine
Registered: 2008-03-22
Posts: 44
Website

Re: wifi-select: for selecting wifi network from console (based on netcfg)

Hi! Sorry for the late answer: I have just returned from my vacation.

Daenyth wrote:

Awesome tool! If you want it put into community, let me know and I'll be glad to adopt it on AUR.

Yeah, it would be great!

Daenyth wrote:

Also, if you do end up making it so that it can scan all netcfg profiles for a match, look for a match based on MAC address of the router, not the ESSID, if that's possible...

Hm, but MAC addresses are not usually specified in netcfg profiles... Could you please be more specific in describing of new desired way of working?

Thanks!


With best regards,
Ivan N. Veselov.

Offline

Board footer

Powered by FluxBB