-
Notifications
You must be signed in to change notification settings - Fork 1
/
aruba_ap_ch_csr9.php
125 lines (107 loc) · 3.44 KB
/
aruba_ap_ch_csr9.php
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
<?php
if (!isset($_GET["post"])) {
echo "<h1>Aruba AP static channels via CSV file</h1>";
echo "<form action='?post=1' method='post' enctype='multipart/form-data'>";
echo "<input type='file' name='csv' />";
echo "<br />(column field names should be on the first row)";
echo "<br />Field AP name: <input type='text' name='ap_name' value='ap_name' />";
echo "<br />Field 5GHz channel: <input type='text' name='ch5' value='ch5' />";
echo "<br />Field 5GHz tx power: <input type='text' name='tx5' value='tx5' />";
echo "<br />Field 5GHz gain: <input type='text' name='gain5' value='gain5' />";
echo "<br />Field 2.4GHz channel: <input type='text' name='ch2' value='ch2' />";
echo "<br />Field 2.4GHz tx power: <input type='text' name='tx2' value='tx2' />";
echo "<br />Field 2.4GHz gain: <input type='text' name='gain2' value='gain2' />";
echo "<br />ARM profile for static channel assignment: <input type='text' name='arm_prof' value='arm-{$_GET["prefix"]}static' />";
echo "<br />Radio profile for 802.11g airmonitor: <input type='text' name='11g_airmon' value='rp-monitor-g' />";
echo "<br />Radio profile for 802.11a airmonitor: <input type='text' name='11a_airmon' value='rp-monitor-a' />";
echo "<br />Comma separator: <input type='text' name='separator' value=',' />";
echo "<br /><br /><input type='submit' value='OK' />";
echo "</form>";
}
else {
if ($_POST["arm_prof"] == "") {
echo "Please enter an ARM profile value.";
exit;
}
$in = file_get_contents($_FILES['csv']['tmp_name']);
$arm_prof = $_POST["arm_prof"];
$in = explode("\n",$in);
$tmp = explode($_POST["separator"], $in[0]);
$col_names = array("ap_name","ch5","tx5","gain5","ch2","tx2","gain2");
$col_pos = array();
$i = 0;
foreach ($tmp as $col) {
foreach ($col_names as $cname) {
if ($_POST[$cname] == trim($col)) {
$col_pos[$cname] = $i;
}
}
$i++;
}
$i = 0;
foreach ($in as $line) {
if ($i == 0) {
$i++;
continue;
}
$tmp = explode($_POST["separator"],$line);
$name = $tmp[$col_pos["ap_name"]];
$ch5 = $tmp[$col_pos["ch5"]];
$tx5 = $tmp[$col_pos["tx5"]];
$gain5 = $tmp[$col_pos["gain5"]];
$ch2 = $tmp[$col_pos["ch2"]];
$tx2 = $tmp[$col_pos["tx2"]];
$gain2 = $tmp[$col_pos["gain2"]];
if (intval($ch5) >= 36) {
$tx5 = intval($tx5) + intval($gain5);
echo nl2br('rf dot11a-radio-profile "ch' . $ch5 . '-' . $tx5 . 'dbm"
channel ' . $ch5 . '
tx-power ' . $tx5 . '
dot11h
csa
beacon-period 100
cell-size-reduction 9
spectrum-monitoring
arm-profile "' . $arm_prof . '"
!
ap-name "' . $name . '"
dot11a-radio-profile "ch' . $ch5 . '-' . $tx5 . 'dbm"
!
');
}
if (trim($ch5) == "airmon") {
echo nl2br('ap-name "' . $name . '"
dot11a-radio-profile "' . $_POST["11a_airmon"] . '"
!
');
}
if (intval($ch2) >= 1) {
$tx2 = intval($tx2) + intval($gain2);
echo nl2br('rf dot11g-radio-profile "ch' . $ch2 . '-' . $tx2 . 'dbm"
very-high-throughput-rates-enable
channel ' . $ch2 . '
tx-power ' . $tx2 . '
dot11h
csa
beacon-period 200
no dot11b-protection
cell-size-reduction 9
spectrum-monitoring
interference-immunity 3
arm-profile "' . $arm_prof . '"
!
ap-name "' . $name . '"
dot11g-radio-profile "ch' . $ch2 . '-' . $tx2 . 'dbm"
!
');
}
if (trim($ch2) == "airmon") {
echo nl2br('ap-name "' . $name . '"
dot11g-radio-profile "' . $_POST["11g_airmon"] . '"
!
');
}
$i++;
}
}
?>