-
Notifications
You must be signed in to change notification settings - Fork 8
/
example_list_aps.cpp
61 lines (47 loc) · 1.98 KB
/
example_list_aps.cpp
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
/**
* wlanapi library 0.4
*
* Copyright (C) 2008, 2009 Moritz Mertinkat <[email protected]>
* All rights reserved.
*
* wlanapi library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* wlanapi library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.*
*
* You should have received a copy of the GNU General Public License
* along with wlanapi library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <vector>
#include <string>
#include <stdexcept>
#include "library/wlanapi.h"
using namespace std;
int main() {
wlanapi *wi = new wlanapi();
try {
const ADAPTER_LIST &adapter_list = wi->get_adapter_list();
const AP_LIST &ap_list = wi->get_ap_list(NULL);
for (AP_LIST::const_iterator it = ap_list.begin(); it < ap_list.end(); ++it) {
printf("ap name: %s\n", it->name);
printf("ap mac address: %02x-%02x-%02x-%02x-%02x-%02x\n", it->mac_address.u[0],
it->mac_address.u[1],
it->mac_address.u[2],
it->mac_address.u[3],
it->mac_address.u[4],
it->mac_address.u[5]);
printf("ap rssi: %i\n", it->rssi);
printf("\n");
}
} catch (std::exception &e) {
printf("[X] %s\n", e.what());
}
printf("Press enter to exit.");
scanf("...");
delete wi;
}