NAME

wlan-ui.pl - UI for selecting and connecting to WLAN access points (APs)


SYNOPSIS

wlan-ui.pl -key my_essid=1234567890 -list my_essid

Options:

    -help            print help message and quit
    -man             full documentation and quit
    -verbose         more messages, more detailed help output
    -quiet           no messages during operation
    -version         returns version no
    -key             ESSID=wep_key_value pairs
    -passwd          ESSID=password pairs
    -list            specify  ESSID to put at top of list for connect
    -rescan_interval interval (in seconds) to rescan if no APs found
    -rescan_count    number of times to rescan if no APs found
    -quit_on_connect whether to quit program when successfully connected
    -autoconnect     try to connect to any APs listed as good for autoconnect
    -autoconnect_to  give ESSID name of AP for which to try autoconnect 
    -noui            just do autoconnect, don't start UI for connect if fails 
    @configfile
    Options configuration file containing any of the options above in
    format given by Getopts::Argvfile E<lt>www.cpan.orgE<gt> - the
    format is the same as for the command line, but allowing multiple
    lines and comments.


OPTIONS

-help
Print a long help message and exit.

-man
Output the man page and exit.

-verbose
Gives out some extra messages as it works. Adding -verbose to -help outputs more help.

-quiet
Gives less messages.

-version
Returns version no to the console.

-key
Specify WEP key(s) to use for connecting to a particular ESSID; e.g.
  wlan-ui.pl -key my_essid=1234567890 -key other_essid=0987654321

-passwd
Specify password(s) to use for connecting to a particular ESSID; e.g.
 wlan-ui.pl -passwd my_essid=my_pass1 -key other_essid=my_pass2

-list
Specifies one or more ESSIDs to put at top of list for connect; e.g.
 wlan-ui.pl -list my_essid -list other_essid

The APs are listed in the order they appear on the command line (or in the options file - see below). APs are only listed if they also appear in the interface scan results. APs not specified using the -list option, but detected by the interface scan, are listed in order of signal strength.

-rescan_interval
Sets the interval (in seconds) to wait before rescanning for APs, if no APs found (default 2).

-rescan_count
Sets the number of times to rescan if no APs found (default 1).

-quit_on_connect
By default, and with the -quit_on_connect option, the program will finish when connection to an AP is successful. To reverse this default (so program does not quit) use the -noquit_on_connect version of this option.

-autoconnect
If this option is set, wlan-ui.pl will search for any APs listed as good for autoconnecting (see -autoconnect_to below), and which either do not need encryption, or have passwords / WEP keys given elsewhere in the options (see -key, -passwd). If it finds such an AP, it will try and connect. If the connection is successful, the GUI will not start, and the program stops. If it fails, by default, wlan-ui.pl launches the GUI (see -noui option below).

-autoconnect_to
Give one or many ESSID names of APs for which to try autoconnect; e.g.
 wlan-ui.pl -autoconnect_to my_essid -autoconnect_to other_essid

-noui
If this option is set, the program will only try and autoconnect; if it fails, it will not launch the GUI to select another AP.


CONFIGFILE

wlan-ui.pl uses two types of configuration file, a system configuration file (see INSTALLATION below), and option configuration files, described here.

Option configuration files can specify options in the same format as for the command line, except options can be specified across many lines, and comments can be interposed: e.g

 wlan-ui.pl -verbose @myconfig

where ``myconfig'' might be the following text file

 # Configuration file for wlan-ui perl program
 -key "my_essid"='1234567890'
 -key 'test essid'='0987654321'
 -list my_essid
 -list other_essid
 -autoconnect_to my_essid
 -autoconnect

This file sets the WEP keys for my_essid and test_essid, puts my_essid and other_essid at the top of listed APs (if they turn up on a scan), and will attempt to connect to my_essid on startup.

Configuration files are read in the following order: .wlan-ui.pl in the directory of the wlan-ui.pl script; .wlan-ui.pl in your home directory; .wlan-ui.pl in the current directory; and any configuration file passed on the command line. Options in files read later override those in earlier files. Options passed on the command line override options passed in .wlan-ui.pl files, and any options specified earlier on the the command line than the @configfile item.


REQUIREMENTS

You will need various CPAN modules installed <http://www.cpan.org>:

   Gtk2
   Gtk2::GladeXML
   IO::Select
   Digest::MD5
   Getopt::ArgvFile
   Pod::Usage


INSTALLATION

Installation is simple and inelegant. Copy the program file (wlan-ui.pl) to a directory on your path. Next, create a new system configuration file to reflect your system. The system configuration file is different from the options configuration file (@configfile, above). The system configuration file tells the program how to configure the wireless interface, and the options configuration file sets defaults for access points and other things. The default location of the system configuration file is /etc/wlan-uirc; you can change this by editing the contents of the $sys_config variable in the program file. Below is an example file, which uses the ipw2200 module <http://ipw2100.sourceforge.net> as my wireless driver. By default this gives me a network device attached to 'wlan0'.

  # Example system configuration file 
  # Edit and save as /etc/wlan-uirc
  # Wireless driver module to load
  $MODULE = 'ipw2200';
  # Module parameters
  $MODULEPARAMS = '';
  # Wireless network device - e.g. 'wlan0'.
  # If not defined we use /proc/net/wireless to find the device
  $DEVICE = undef;
  # Commands for manipulating wlan module etc
  # We will find unspecified commands from the path
  $CMDS = {'lsmod',  '/sbin/lsmod', 
           'modprobe', '/sbin/modprobe',
           'load',     undef,       # modprobe used by default
           'unload',   undef,       # modprobe -r used by default
           'iwconfig', '/sbin/iwconfig',
           'iwlist',   '/sbin/iwlist',
           'ifconfig', '/sbin/ifconfig',
           'ps',       undef,
           'dhcpcd',   '/sbin/dhclient'};

The 'load' and 'unload' commands are usually left undefined, as above, but if you want to use scripts, you can define them. For example, the driverloader wireless driver <http://www.linuxant.com> uses a system init script to start and stop the wireless driver. To make this work, you could try something like:

  $MODULE = 'driverloader';  
  $CMDS = {'lsmod',  '/sbin/lsmod', 
           'modprobe', undef,      # not needed in this case
           'load',     "/sbin/service $MODULE start",
           'unload',   "/sbin/service $MODULE stop", 
  ...

Note the quotes (``) around the load and unload command, to allow variable substitution.

If you leave the $DEVICE variable undefined, the script will try and find your wireless network device using the /proc/net/wireless interface. If this fails, you will get messages including ``WLAN device not found'', and will need to set the $DEVICE variable to the name of your wireless interface (e.g. $DEVICE = 'wlan0';).

You can leave $MODULE undefined, in which case the wireless interface is assumed to be always up, and no attempt is made to check, unload etc, and you don't need to define lsmod; modprobe; load; unload.

wlan-ui.pl will need root permissions to run the various wireless configuration programs. I do this by giving myself sudo permission to run the script. Here's some excerpts from my /etc/sudoers file:

   # Host alias specification
   Host_Alias   LAPTOP = fetastra
   # User alias specification
   User_Alias   WIRELESS = myself, myfriend
   # Run wlan-ui
   WIRELESS LAPTOP = NOPASSWD: /usr/local/bin/wlan-ui.pl

I can then run wlan-ui.pl with

  sudo /usr/local/bin/wlan-ui.pl

For some security, make sure wlan-ui.pl is writeable only by root.

Note that the system configuration file (/etc/wlan-uirc) can contain commands that will be executed from within the program. You may want to make sure that the configuration file is only writeable by root.


DESCRIPTION

wlan-ui.pl is a program to connect to wireless networks. It can be run as a GUI which will offer a list of available networks to connect to.

wlan-ui.pl is based on wlan-zenity, written by Mirza Muharemagic <http://www.php.co.ba/X31> and released under the BSD license.


FEATURES

See description of options for list of features.


ODD FEATURES

We don't currently use the MAC address of the AP when connecting. This will give odd effects when there is more than one AP with the same ESSID. Search for the get_ap_by_essid function in the wlan-ui.pl file to see where this will cause a problem.


AUTHORS

Matthew Brett <matthewb berkeley.edu>

Mirza Muharemagic <http://www.php.co.ba/X31>


LICENSE

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License distributed with Perl version 5.003 or (at your option) any later version. Please refer to the Artistic License that came with your Perl distribution for more details.