Zane C. Bowers-Hadley

NAME

Net::Wireless::802_11::WPA::CLI - Provides a interface to wpa_cli.

VERSION

Version 2.1.0

SYNOPSIS

    use Net::Wireless::802_11::WPA::CLI;

    my $foo = Net::Wireless::802_11::WPA::CLI->new();
    ...

FUNCTIONS

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);
    }

add_network

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);
    }

bss

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.

returned hash

bssid

This is the BSSID in for the base station ID.

freq

This is the frequency in Mhz.

beacon_int

This is the beacon interval.

capabilities

This is the AP capabilities.

qual

This is the signal quality.

noise

This is the signal noise level.

level

This is the RSSI.

tsf

This is the timing syncronization function.

ie

This is what ever the ie value is.

flags

This is the flags for the AP.

ssid

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

Disconnect and wait for a reassosiate command.

No arguments are taken.

        $return=$foo->disconnect;
    if( $foo->error ){
        warn('Error:'.$foo->error.': '.$foo->errorString);
    }

disable_network

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);
    }

enable_network

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);
    }

get_capability

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

No arguments are taken.

        my @capabilities=$foo->get_capability('eap');
    if( $foo->error ){
        warn('Error:'.$foo->error.': '.$foo->errorString);
    }

get_network

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);
    }

list_networks

This lists the configured networks.

No arguments are taken.

The returned value is a hash.

returned hash.

The keys for the hash is the numeric network ID. Each item in the hash is a hash. The keys are listed below.

ssid

This is the SSID of the network in question.

bssid

This is the BSSID of the network in question. If not specified, it will be set to 'any'.

flags

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);
    }

new_password

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);
    }

pin

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);
    }

preauthenticate

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);
    }

reassociate

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);
    }

reconfigure

This causes wpa_supplicant to reread it's configuration file.

No arguments are taken.

        $return=$obj->reconfigure;
    if( $foo->error ){
        warn('Error:'.$foo->error.': '.$foo->errorString);
    }

remove_network

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);
    }

save_config

This saves the current configuration. The user requesting this does not need write permissions to file being used

No arguments are taken.

        my $returned=$foo->save_config;
    if( $foo->error ){
        warn('Error:'.$foo->error.': '.$foo->errorString);
    }

scan

This requests a new BSS scan.

No arguments are taken.

        my $returned=$foo->scan;
    if( $foo->error ){
        warn('Error:'.$foo->error.': '.$foo->errorString);
    }

scan_results

This returns the scan results.

No arguments are taken.

The returned value is a hash.

returned hash

Each keys of the hash is a BSSID. It's value is another hash with the keys listed below.

ssid

This is the SSID for the AP.

frequency

This is the frequency of the AP. The value is in Mhz.

signallevel

This is the signal level of the seen AP.

flags

This is the flags for the 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++;
        }
    }

select_network

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);
    }

set_network

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);
    }

status

This function gets the current status from wpa_cli.

No arguments are taken.

    my %status=$foo->status;
    if( $foo->error ){
            warn('Error:'.$foo->error.': '.$foo->errorString);
    }
    

mib

This gets the MIB variables (dot1x, dot11).

        %return=$foo->mib;
    if( $foo->error ){
            warn('error:'.$foo->error.': '.$foo->errorString);
        }

run_TF_command

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);
        }

run_command

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);
    }

status_breakdown

This is a internal function.

NOTES

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.

ERROR CODES

1

Unable to to initialize the object. A wpa_cli status check failed.

This error is permanent.

2

Status breakdown failed because of a unexpected return.

3

Command failed and exited with a non-zero.

4

Invalid argument supplies.

5

The executed command exited with zero, but still failed.

This error code is not warned for.

6

Unknown return.

AUTHOR

Zane C. Bowers-Hadley, <vvelox at vvelox.net>

BUGS

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.

SUPPORT

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:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

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.