This file is indexed.

/usr/share/perl5/SNMP/Info/IEEE802dot11.pm is in libsnmp-info-perl 3.39-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# SNMP::Info::IEEE802dot11
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#     * Redistributions of source code must retain the above copyright notice,
#       this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#     * Neither the name of the University of California, Santa Cruz nor the
#       names of its contributors may be used to endorse or promote products
#       derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

package SNMP::Info::IEEE802dot11;

use strict;
use Exporter;

@SNMP::Info::IEEE802dot11::ISA       = qw/Exporter/;
@SNMP::Info::IEEE802dot11::EXPORT_OK = qw//;

use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;

$VERSION = '3.39';

%MIBS = ( 'IEEE802dot11-MIB' => 'dot11DesiredSSID', );

%GLOBALS = ();

%FUNCS = (

    # dot11PhyOFDMTable
    'dot11_cur_freq' => 'dot11CurrentFrequency',

    # dot11PhyDSSSTable
    'dot11_cur_ch' => 'dot11CurrentChannel',

    # dot11PhyOperationTable
    'dot11_phy_type' => 'dot11PHYType',
    'dot11_reg_dom'  => 'dot11CurrentRegDomain',

    # dot11ResourceInfoTable
    'dot11_prod_ver'  => 'dot11manufacturerProductVersion',
    'dot11_prod_name' => 'dot11manufacturerProductName',
    'dot11_man_name'  => 'dot11manufacturerName',

    # dot11OperationTable
    'dot11_mac' => 'dot11MACAddress',

    # dot11StationConfigTable
    'dot11_bss_type' => 'dot11DesiredBSSType',
    'i_ssidlist'     => 'dot11DesiredSSID',
    'dot11_pwr_mode' => 'dot11PowerManagementMode',
    'dot11_sta_id'   => 'dot11StationID',

    # dot11PhyTxPowerTable
    'dot11_cur_tx_pwr'     => 'dot11CurrentTxPowerLevel',
    'dot11_tx_pwr_level_1' => 'dot11TxPowerLevel1',
    'dot11_tx_pwr_level_2' => 'dot11TxPowerLevel2',
    'dot11_tx_pwr_level_3' => 'dot11TxPowerLevel3',
    'dot11_tx_pwr_level_4' => 'dot11TxPowerLevel4',
    'dot11_tx_pwr_level_5' => 'dot11TxPowerLevel5',
    'dot11_tx_pwr_level_6' => 'dot11TxPowerLevel6',
    'dot11_tx_pwr_level_7' => 'dot11TxPowerLevel7',
    'dot11_tx_pwr_level_8' => 'dot11TxPowerLevel8',
);

%MUNGE = (
    'dot11_mac'    => \&SNMP::Info::munge_mac,
    'dot11_sta_id' => \&SNMP::Info::munge_mac,
);

sub vendor {
    my $dot11 = shift;

    my $names = $dot11->dot11_man_name();

    foreach my $iid ( keys %$names ) {
        my $vendor = $names->{$iid};
        next unless defined $vendor;
        if ( $vendor =~ /^(\S+)/ ) {
            return lc($1);
        }
    }

    return;
}

sub model {
    my $dot11 = shift;

    my $names = $dot11->dot11_prod_name();

    foreach my $iid ( keys %$names ) {
        my $prod = $names->{$iid};
        next unless defined $prod;
        return lc($prod);
    }
    return;
}

sub os_ver {
    my $dot11 = shift;

    my $versions = $dot11->dot11_prod_ver();

    foreach my $iid ( keys %$versions ) {
        my $ver = $versions->{$iid};
        next unless defined $ver;
        if ( $ver =~ /([\d\.]+)/ ) {
            return $1;
        }
    }

    return;
}

sub i_80211channel {
    my $dot11 = shift;

    my $phy_type = $dot11->dot11_phy_type() || {};
    my $cur_freq = $dot11->dot11_cur_freq() || {};
    my $cur_ch   = $dot11->dot11_cur_ch()   || {};

    my %i_80211channel;
    foreach my $iid ( keys %$phy_type ) {
        my $type = $phy_type->{$iid};
        next unless defined $type;
        if ( $type =~ /dsss/ ) {
            my $ch = $cur_ch->{$iid};
            next unless defined $ch;
            $i_80211channel{$iid} = $ch;
        }
        elsif ( $type =~ /ofdm/ ) {
            my $ch = $cur_freq->{$iid};
            next unless defined $ch;
            $i_80211channel{$iid} = $ch;
        }
        else {
            next;
        }
    }

    return \%i_80211channel;
}

sub dot11_cur_tx_pwr_mw {
    my $dot11               = shift;
    my $partial             = shift;
    my $cur                 = $dot11->dot11_cur_tx_pwr($partial);
    my $dot11_cur_tx_pwr_mw = {};
    foreach my $idx ( keys %$cur ) {
        my $pwr = $cur->{$idx};
        if ( $pwr >= 1 && $pwr <= 8 ) {

            # ToDo - Look at string eval
            my $mw
                = eval "\$dot11->dot11_tx_pwr_level_$pwr(\$idx)"; ## no critic
            $dot11_cur_tx_pwr_mw->{$idx} = $mw->{$idx};
        }
        else {
            next;
        }
    }
    return $dot11_cur_tx_pwr_mw;
}

1;

__END__

=head1 NAME

SNMP::Info::IEEE802dot11 - SNMP Interface to data from F<IEEE802dot11-MIB>

=head1 AUTHOR

Eric Miller

=head1 SYNOPSIS

    my $dot11 = new SNMP::Info(
                          AutoSpecify => 1,
                          Debug       => 1,
                          DestHost    => 'myswitch',
                          Community   => 'public',
                          Version     => 2
                        ) 

    or die "Can't connect to DestHost.\n";

    my $class = $dot11->class();
    print " Using device sub class : $class\n";

=head1 DESCRIPTION

SNMP::Info::IEEE802dot11 is a subclass of SNMP::Info that provides an
interface to F<IEEE802dot11-MIB>.  This MIB is used in standards based
802.11 wireless devices.

Use or create a subclass of SNMP::Info that inherits this one.
Do not use directly.

=head2 Inherited Classes

=over

None.

=back

=head2 Required MIBs

=over

=item F<IEEE802dot11-MIB>

=back

=head1 GLOBALS

These are methods that return scalar value from SNMP

=over

=item $dot11->vendor()

Tries to discover the vendor from dot11_man_name() - returns lower case
of the first word in the first instance found.

=item $dot11->model()

Tries to discover the model from dot11_prod_name() - returns lower case
of the first instance found.

=item $dot11->os_ver()

Tries to discover the operating system version from dot11_prod_ver() - returns
string of numeric and decimals in the first instance found.

=back

=head1 TABLE METHODS

These are methods that return tables of information in the form of a reference
to a hash.

=over

=item $dot11->i_ssidlist()

Returns reference to hash.  SSID's recognized by the radio interface.

(C<dot11DesiredSSID>)

=item $dot11->i_80211channel()

Returns reference to hash.  Current operating frequency channel of the radio
interface.

=item $dot11->dot11_cur_tx_pwr_mw()

Returns reference to hash.  Current transmit power, in milliwatts, of the
radio interface.

=back

=head2 Dot11 Phy OFDM Table  (C<dot11PhyOFDMTable>)

=over

=item $dot11->dot11_cur_freq()

(C<dot11CurrentFrequency>)

=back

=head2 Dot11 Phy DSSS Table  (C<dot11PhyDSSSTable>)

=over

=item $dot11->dot11_cur_ch()

(C<dot11CurrentChannel>)

=back

=head2 Dot11 Phy Operation Table  (C<dot11PhyOperationTable>)

=over

=item $dot11->dot11_phy_type()

(C<dot11PHYType>)

=item $dot11->dot11_reg_dom()

(C<dot11CurrentRegDomain>)

=back

=head2 Dot11 Resource Information Table  (C<dot11ResourceInfoTable>)

=over

=item $dot11->dot11_prod_ver()

(C<dot11manufacturerProductVersion>)

=item $dot11->dot11_prod_name()

(C<dot11manufacturerProductName>)

=item $dot11->dot11_man_name()

(C<dot11manufacturerName>)

=back

=head2 Dot11 Operation Table  (C<dot11OperationTable>)

=over

=item $dot11->dot11_mac()

(C<dot11MACAddress>)

=back

=head2 Dot11 Station Configuration Table  (C<dot11StationConfigTable>)

=over

=item $dot11->dot11_bss_type()

(C<dot11DesiredBSSType>)

=item $dot11->dot11_pwr_mode()

(C<dot11PowerManagementMode>)

=item $dot11->dot11_sta_id()

(C<dot11StationID>)

=back

=head2 Dot11 Transmission Power Table  (C<dot11PhyTxPowerTable>)

=over

=item $dot11->dot11_cur_tx_pwr()

(C<dot11CurrentTxPowerLevel>)

=item $dot11->dot11_tx_pwr_level_1()

(C<dot11TxPowerLevel1>)

=item $dot11->dot11_tx_pwr_level_2()

(C<dot11TxPowerLevel2>)

=item $dot11->dot11_tx_pwr_level_3()

(C<dot11TxPowerLevel3>)

=item $dot11->dot11_tx_pwr_level_4()

(C<dot11TxPowerLevel4>)

=item $dot11->dot11_tx_pwr_level_5()

(C<dot11TxPowerLevel5>)

=item $dot11->dot11_tx_pwr_level_6()

(C<dot11TxPowerLevel6>)

=item $dot11->dot11_tx_pwr_level_7()

(C<dot11TxPowerLevel7>)

=item $dot11->dot11_tx_pwr_level_8()

(C<dot11TxPowerLevel8>)

=back

=cut