Net::Wireless::802_11::WPA::CLI - Provides a interface to wpa_cli.
Version 2.1.0
use Net::Wireless::802_11::WPA::CLI; my $foo = Net::Wireless::802_11::WPA::CLI->new(); ...
This initializes the object to be used for making use of wpa_cli.
my $foo->Net::Wireless::802_11::WPA::CLI->new(); if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This adds a network.
No arguments are taken.
The returned value is a the new network ID.
$newNetworkID=$foo->add_network; if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This requests additional information about a AP found in scan_results.
A single argument is required and it is the BSSID.
The returned value is a hash.
This is the BSSID in for the base station ID.
This is the frequency in Mhz.
This is the beacon interval.
This is the AP capabilities.
This is the signal quality.
This is the signal noise level.
This is the RSSI.
This is the timing syncronization function.
This is what ever the ie value is.
This is the flags for the AP.
This is the SSID for the for AP in question.
my %status=$foo->bss($bssid); if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
Disconnect and wait for a reassosiate command.
$return=$foo->disconnect; if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This disables a network ID.
One argument is required and that is the network ID in question.
$foo->disable_network($networkID) if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This enables a network ID.
One argument is required and that is the network ID to enable.
$foo->enable_network($networkID) if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This returns the capabilities for the requested item. The capabilities that can be requested are as below.
eap pairwise group key_mgmt proto auth_alg
my @capabilities=$foo->get_capability('eap'); if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This gets a variable for for a specific network ID.
Two arguments are taken and that is the network ID and variable.
$value=$foo->get_network($networkID, $variable); if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This lists the configured networks.
The keys for the hash is the numeric network ID. Each item in the hash is a hash. The keys are listed below.
This is the SSID of the network in question.
This is the BSSID of the network in question. If not specified, it will be set to 'any'.
This is the flags for the network. This key may not be defined.
%return=$foo->list_networks; if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This sets a new password for a network.
Two arguments are taken. The first is the network ID and the second is the new password.
$return=$foo->new_password($networkID, $newpass); if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This sets the pin for a network.
Two arguments are taken. The first is the network ID and the second is the pin.
$foo->pin($networkID, $newpin); if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
Force preauthentication for a BSSID.
One argument is accepted and the is the BSSID in question.
$foo->preauthenticate($BSSID); if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This saves the current configuration. The user requesting this does not need write permissions to file being used
It takes no arguments.
$foo->reassociate; if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This causes wpa_supplicant to reread it's configuration file.
$return=$obj->reconfigure; if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This removes the specified network.
One argument is accepted and it the network ID.
$return=$foo->remove_network($networkID) if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
my $returned=$foo->save_config; if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This requests a new BSS scan.
my $returned=$foo->scan; if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This returns the scan results.
Each keys of the hash is a BSSID. It's value is another hash with the keys listed below.
This is the SSID for the AP.
This is the frequency of the AP. The value is in Mhz.
This is the signal level of the seen AP.
my %scan=$foo->scan_results; if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }else{ print "BSSID, SSID, FREQ, SIGNAL, FLAGS\n"; my @keys=keys(%scan); my $int=0; while( defined( $keys[$int] ) ){ print $keys[$int].', '.$scan{$keys[$int]}{ssid}.', '. $scan{$keys[$int]}{frequency}.', ' .$scan{$keys[$int]}{signal}.', ' .$scan{$keys[$int]}{flags}; $int++; } }
This is the network ID to select, while disabling the others.
One argument is accepted and it is the network ID to select.
$return=$foo->select_network($networkID) if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This sets a variable for for a specific network ID.
Three arguments are taken. The first is the network ID, the second is the variable to set, and the third is the value to set it to.
$foo->set_network($networkID, $variable, $value); if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This function gets the current status from wpa_cli.
my %status=$foo->status; if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This gets the MIB variables (dot1x, dot11).
%return=$foo->mib; if( $foo->error ){ warn('error:'.$foo->error.': '.$foo->errorString); }
This runs a arbirary command in which the expected values are either 'FAIL' or 'OK'. This function is largely intended for internal use by this module.
It takes two argument. The first is string containing the command and any arguments for it. The second is what to return on a unknown return.
A status of 'FAIL' will also set a error of 5.
A unknown status will also set a error of 6.
$returned=$foo->run_TF_command($command, 0); if( $foo->error ){ warn('error:'.$foo->error.': '.$foo->errorString); }
This runs a arbirary command in which. This function is largely intended for internal use by this module.
It takes argument, which is string containing the command and any arguments for it.
UNDEF is returned upon with running wpa_cli. Otherwise the return is the return from executed command.
$returned=$foo->run_command($command) if( $foo->error ){ warn('Error:'.$foo->error.': '.$foo->errorString); }
This is a internal function.
This makes use of wpa_cli in a non-interactive form. This means that interface and otp are not usable.
Better documentation and etc shall be coming shortly. Publishing this and starting work on something that uses it in it's current form.
Unable to to initialize the object. A wpa_cli status check failed.
This error is permanent.
Status breakdown failed because of a unexpected return.
Command failed and exited with a non-zero.
Invalid argument supplies.
The executed command exited with zero, but still failed.
This error code is not warned for.
Unknown return.
Zane C. Bowers-Hadley, <vvelox at vvelox.net>
<vvelox at vvelox.net>
Please report any bugs or feature requests to bug-net-wireless-802_11--wpa-cli at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Wireless-802_11-WPA-CLI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-net-wireless-802_11--wpa-cli at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Net::Wireless::802_11::WPA::CLI
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Wireless-802_11-WPA-CLI
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Net-Wireless-802_11-WPA-CLI
CPAN Ratings
http://cpanratings.perl.org/d/Net-Wireless-802_11-WPA-CLI
Search CPAN
http://search.cpan.org/dist/Net-Wireless-802_11-WPA-CLI
Copyright 2011 Zane C. Bowers-Hadley, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Net::Wireless::802_11::WPA::CLI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Wireless::802_11::WPA::CLI
CPAN shell
perl -MCPAN -e shell install Net::Wireless::802_11::WPA::CLI
For more information on module installation, please visit the detailed CPAN module installation guide.