| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package NetStumbler::Wap; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
30988
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
57
|
|
|
4
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
710
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# We do not Export anything |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
{ |
|
26
|
1
|
|
|
1
|
1
|
11
|
my $proto = shift; |
|
27
|
1
|
|
33
|
|
|
8
|
my $class = ref($proto) || $proto; |
|
28
|
1
|
|
|
|
|
3
|
my $self = {} ; |
|
29
|
1
|
|
|
|
|
2
|
$self->{VENDORS} = {}; |
|
30
|
1
|
|
|
|
|
4
|
bless ($self, $class); |
|
31
|
1
|
|
|
|
|
4
|
return $self; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub initialize |
|
35
|
|
|
|
|
|
|
{ |
|
36
|
1
|
|
|
1
|
0
|
6
|
my $self = shift; |
|
37
|
1
|
|
|
|
|
7
|
while() |
|
38
|
|
|
|
|
|
|
{ |
|
39
|
424
|
100
|
|
|
|
817
|
if(/END/) |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
1
|
|
|
|
|
5
|
last; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
423
|
|
|
|
|
400
|
chomp; |
|
44
|
423
|
|
|
|
|
835
|
my ($prefix,$ven) = split(/\t/); |
|
45
|
423
|
50
|
33
|
|
|
1960
|
if($prefix && $prefix =~ /\w\w:\w\w:\w\w/i) |
|
46
|
|
|
|
|
|
|
{ |
|
47
|
423
|
|
|
|
|
427
|
chomp($ven); |
|
48
|
423
|
|
|
|
|
2150
|
$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
|
|
|
|
|
|
|
{ |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
71
|
0
|
|
|
|
|
0
|
my $flags = shift; |
|
72
|
0
|
|
|
|
|
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
|
|
|
|
|
|
|
{ |
|
91
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
92
|
0
|
|
|
|
|
0
|
my $flags = shift; |
|
93
|
0
|
|
|
|
|
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
|
|
|
|
|
|
|
{ |
|
112
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
113
|
0
|
|
|
|
|
0
|
my $flags = shift; |
|
114
|
0
|
|
|
|
|
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 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
|
|
|
|
|
|
|
{ |
|
133
|
3
|
|
|
3
|
1
|
11
|
my $self = shift; |
|
134
|
3
|
|
|
|
|
6
|
my $mac = shift; |
|
135
|
3
|
100
|
|
|
|
9
|
if(length($mac) > 12) |
|
136
|
|
|
|
|
|
|
{ |
|
137
|
1
|
|
|
|
|
3
|
my $prefix = substr($mac,0,8); |
|
138
|
1
|
|
|
|
|
6
|
return $self->{VENDORS}->{uc($prefix)}; |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
else |
|
141
|
|
|
|
|
|
|
{ |
|
142
|
2
|
|
|
|
|
8
|
my $prefix = substr($mac,0,2) . ":" . substr($mac,2,2) . ":" . substr($mac,4,2); |
|
143
|
2
|
|
|
|
|
14
|
return $self->{VENDORS}->{uc($prefix)}; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
1; |
|
147
|
|
|
|
|
|
|
__DATA__ |