| 1 | package NetStumbler::Wap; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | require Exporter; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||
| 11 | # We do not Export anything | ||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||
| 13 | 1 | our $VERSION = '0.09'; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 Object Methods | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =head2 new() | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | Returns a new Wap object. NOTE: this method may take some time to execute | ||||||||||||||||||||||||||||
| 20 | as it loads the list into memory at construction time | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =cut | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | sub new | ||||||||||||||||||||||||||||
| 25 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | 1 | my $proto = shift; | |||||||||||||||||||||||||||
| 27 | 1 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||
| 28 | 1 | my $self = {} ; | |||||||||||||||||||||||||||
| 29 | 1 | $self->{VENDORS} = {}; | |||||||||||||||||||||||||||
| 30 | 1 | bless ($self, $class); | |||||||||||||||||||||||||||
| 31 | 1 | return $self; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | sub initialize | ||||||||||||||||||||||||||||
| 35 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
initialize: called CC=5 SCAR=16.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 37 | 1 | ▶ | while(<DATA>) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | { | ||||||||||||||||||||||||||||
| 39 | 424 | ▶ | if(/END/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | { | ||||||||||||||||||||||||||||
| 41 | 1 | last; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | 423 | chomp; | |||||||||||||||||||||||||||
| 44 | 423 | my ($prefix,$ven) = split(/\t/); | |||||||||||||||||||||||||||
| 45 | 423 | ▶ | if($prefix && $prefix =~ /\w\w:\w\w:\w\w/i) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$prefix and $prefix =~ /\w\w:\w\w:\w\w/i
MC/DC0%0/2
$prefix and $prefix =~ /\w\w:\w\w:\w\w/i
$prefix
$prefix =~ /\w\w:\w\w:\w\w/i
Truth table33%1/3
A and B
A= $prefixB= $prefix =~ /\w\w:\w\w:\w\w/i
| |||||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||
| 47 | 423 | chomp($ven); | |||||||||||||||||||||||||||
| 48 | 423 | $self->{VENDORS}->{$prefix} = $ven; | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =head2 isAdhoc($flags) | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | Params: | ||||||||||||||||||||||||||||
| 56 | -number 801.11 Capability flags | ||||||||||||||||||||||||||||
| 57 | Returns: | ||||||||||||||||||||||||||||
| 58 | true is the flags indicate the access point is in adhoc mode | ||||||||||||||||||||||||||||
| 59 | Example: | ||||||||||||||||||||||||||||
| 60 | if($obj->isAdhoc($flags)) | ||||||||||||||||||||||||||||
| 61 | { | ||||||||||||||||||||||||||||
| 62 | # do something here | ||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =cut | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | sub isAdhoc | ||||||||||||||||||||||||||||
| 68 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
isAdhoc: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 71 | 0 | my $flags = shift; | |||||||||||||||||||||||||||
| 72 | 0 | return $flags & 0x0002; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =head2 isInfrascruture($flags) | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | Params: | ||||||||||||||||||||||||||||
| 78 | -number 801.11 Capability flags | ||||||||||||||||||||||||||||
| 79 | Returns: | ||||||||||||||||||||||||||||
| 80 | true is the flags indicate the access point is in infrastructure mode | ||||||||||||||||||||||||||||
| 81 | Example: | ||||||||||||||||||||||||||||
| 82 | if($obj->isInfrascructure($flags)) | ||||||||||||||||||||||||||||
| 83 | { | ||||||||||||||||||||||||||||
| 84 | # do something here | ||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =cut | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | sub isInfrastructure | ||||||||||||||||||||||||||||
| 90 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
isInfrastructure: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 91 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 92 | 0 | my $flags = shift; | |||||||||||||||||||||||||||
| 93 | 0 | return !isAdhoc($flags); | |||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | =head2 hasWEP($flags) | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | Params: | ||||||||||||||||||||||||||||
| 99 | -number 801.11 Capability flags | ||||||||||||||||||||||||||||
| 100 | Returns: | ||||||||||||||||||||||||||||
| 101 | true is the flags indicate the access point has WEP enabled | ||||||||||||||||||||||||||||
| 102 | Example: | ||||||||||||||||||||||||||||
| 103 | if($obj->hasWEP($flags)) | ||||||||||||||||||||||||||||
| 104 | { | ||||||||||||||||||||||||||||
| 105 | # do something here | ||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | =cut | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | sub isWEP | ||||||||||||||||||||||||||||
| 111 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
isWEP: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 112 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 113 | 0 | my $flags = shift; | |||||||||||||||||||||||||||
| 114 | 0 | return $flags & 0x0010; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | =head2 getVendorForBBSID ($mac) | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | Determine the vendor or a nic by the MAC prefix | ||||||||||||||||||||||||||||
| 121 | The argument should be a mac address in the format of | ||||||||||||||||||||||||||||
| 122 | 00000000000 | ||||||||||||||||||||||||||||
| 123 | or | ||||||||||||||||||||||||||||
| 124 | 00:00:00:00:00:00 | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | C<getVendorForBBSID> will return the vendor or undef | ||||||||||||||||||||||||||||
| 127 | if the mac address could not be translated to a vendor | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | =cut | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | sub getVendorForBBSID | ||||||||||||||||||||||||||||
| 132 | 3 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
getVendorForBBSID: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 133 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 134 | 3 | my $mac = shift; | |||||||||||||||||||||||||||
| 135 | 3 | ▶ | if(length($mac) > 12) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 136 | { | ||||||||||||||||||||||||||||
| 137 | 1 | my $prefix = substr($mac,0,8); | |||||||||||||||||||||||||||
| 138 | 1 | return $self->{VENDORS}->{uc($prefix)}; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | else | ||||||||||||||||||||||||||||
| 141 | { | ||||||||||||||||||||||||||||
| 142 | 2 | my $prefix = substr($mac,0,2) . ":" . substr($mac,2,2) . ":" . substr($mac,4,2); | |||||||||||||||||||||||||||
| 143 | 2 | return $self->{VENDORS}->{uc($prefix)}; | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | 1 | 1; | |||||||||||||||||||||||||||
| 147 | __DATA__ | ||||||||||||||||||||||||||||