forked from Cacti/plugin_flowview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.php
More file actions
224 lines (193 loc) · 8.7 KB
/
Copy pathvariables.php
File metadata and controls
224 lines (193 loc) · 8.7 KB
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
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2008-2017 The Cacti Group |
| |
| This program 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 2 |
| of the License, or (at your option) any later version. |
| |
| This program 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. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDTool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
/*
# Input arguments (received from the form):
# Name Description
# -----------------------------------------------------------------------
# device An identifying name of the device (e.g. router1)
# flow_select Identifies which flows to include wrt time period
# timespan Using a Timespan instaed of start and end times
# date1 Start date of analysis period
# date2 End date of analysis period
# source_addresses Constrain flows examined to these source IP addresses
# source_ports Constrain flows examined to these source ports
# source_ifs Constrain flows examined to these input interfaces
# source_ases Constrain flows examined to these source ASes
# dest_addresses Constrain flows examined to these dest. IP addresses
# dest_ports Constrain flows examined to these dest. ports
# dest_ifs Constrain flows examined to these output interfaces
# dest_ases Constrain flows examined to these dest. ASes
# tos_fields Constrain flows examined by specified TOS field values
# tcp_flags Constrain flows examined by specified TCP flag values
# protocols Constrain flows examined to these protocols
# print_report Select from these various report options
# stat_report Select from these various statistics options
# cutoff_lines Number of report lines to print out
# cutoff_octets Minimum number of octets for inclusion in report
# sort_field Which report column to sort lines upon
# resolve_addresses Whether or not to resolve IP addresses
*/
global $config;
include_once($config['base_path'] . '/lib/time.php');
$query = '';
if (isset_request_var('query') && get_filter_request_var('query') > 0 && get_request_var('action') == 'loadquery') {
$query = get_filter_request_var('query');
$q = db_fetch_row("SELECT * FROM plugin_flowview_queries WHERE id=$query");
$_POST['query'] = $query = $q['name'];
$_POST['device_name'] = $device = $q['device'];
$_POST['predefined_timespan'] = $timespan = $q['timespan'];
if ($timespan == 0) {
$_POST['date1'] = $date1 = strtoupper($q['startdate']);
$_POST['date2'] = $date2 = strtoupper($q['enddate']);
}else{
$span = array();
get_timespan($span, time(), $timespan, read_user_setting('first_weekdayid'));
$_POST['date1'] = $date1 = $span['current_value_date1'];
$_POST['date2'] = $date2 = $span['current_value_date2'];
}
$_POST['tos_fields'] = $tos_fields = $q['tosfields'];
$_POST['tcp_flags'] = $tcp_flags = $q['tcpflags'];
$_POST['protocols'] = $protocols = $q['protocols'];
$_POST['source_address'] = $source_address = $q['sourceip'];
$_POST['source_port'] = $source_port = $q['sourceport'];
$_POST['source_if'] = $source_if = $q['sourceinterface'];
$_POST['source_as'] = $source_as = $q['sourceas'];
$_POST['dest_address'] = $dest_address = $q['destip'];
$_POST['dest_port'] = $dest_port = $q['destport'];
$_POST['dest_if'] = $dest_if = $q['destinterface'];
$_POST['dest_as'] = $dest_as = $q['destas'];
$_POST['sort_field'] = $sort_field = $q['sortfield'];
$_POST['cutoff_lines'] = $cutoff_lines = $q['cutofflines'];
$_POST['cutoff_octets'] = $cutoff_octets = $q['cutoffoctets'];
$_POST['action'] = $action = $_REQUEST['action'];
$_POST['stat_report'] = $stat_report = $q['statistics'];
$_POST['flow_select'] = $flow_select = $q['includeif'];
$_POST['print_report'] = $print_report = $q['printed'];
$_POST['resolve_addresses'] = $resolve_addresses = $q['resolve'];
} else {
$device = '';
if (isset_request_var('device_name')) {
$device = get_nfilter_request_var('device_name');
}else{
$device = db_fetch_cell("SELECT folder FROM plugin_flowview_devices ORDER BY id LIMIT 1");;
$_POST['device_name'] = $device;
}
$timespan = 0;
if (isset_request_var('predefined_timespan') && get_filter_request_var('predefined_timespan') > 0) {
$timespan = get_request_var('predefined_timespan');
set_request_var('predefined_timespan', $timespan);
$span = array();
get_timespan($span, time(), $timespan, read_user_setting('first_weekdayid'));
$_POST['date1'] = $date1 = $span['current_value_date1'];
$_POST['date2'] = $date2 = $span['current_value_date2'];
}else{
set_request_var('predefined_timespan', '0');
$timespan = 0;
$date1 = date('Y-m-d H:i:s', time() - (8 * 3600));
if (isset_request_var('date1')) {
$date1 = get_nfilter_request_var('date1');
}
$date2 = date('Y-m-d H:i:s');
if (isset_request_var('date2')) {
$date2 = get_nfilter_request_var('date2');
}
}
$tos_fields = '';
if (isset_request_var('tos_fields')) {
$tos_fields = get_nfilter_request_var('tos_fields');
}
$tcp_flags = '';
if (isset_request_var('tcp_flags')) {
$tcp_flags = get_nfilter_request_var('tcp_flags');
}
$protocols = '';
if (isset_request_var('protocols')) {
$protocols = get_nfilter_request_var('protocols');
}
$source_address = '';
if (isset_request_var('source_address')) {
$source_address = get_nfilter_request_var('source_address');
}
$source_port = '';
if (isset_request_var('source_port')) {
$source_port = get_nfilter_request_var('source_port');
}
$source_if = '';
if (isset_request_var('source_if')) {
$source_if = get_nfilter_request_var('source_if');
}
$source_as = '';
if (isset_request_var('source_as')) {
$source_as = get_nfilter_request_var('source_as');
}
$dest_address = '';
if (isset_request_var('dest_address')) {
$dest_address = get_nfilter_request_var('dest_address');
}
$dest_port = '';
if (isset_request_var('dest_port')) {
$dest_port = get_nfilter_request_var('dest_port');
}
$dest_if = '';
if (isset_request_var('dest_if')) {
$dest_if = get_nfilter_request_var('dest_if');
}
$dest_as = '';
if (isset_request_var('dest_as')) {
$dest_as = get_nfilter_request_var('dest_as');
}
$sort_field = 4;
if (isset_request_var('sort_field')) {
$sort_field = get_nfilter_request_var('sort_field');
}
$cutoff_lines = 100;
if (isset_request_var('cutoff_lines')) {
$cutoff_lines = get_nfilter_request_var('cutoff_lines');
}
$cutoff_octets = '';
if (isset_request_var('cutoff_octets')) {
$cutoff_octets = get_nfilter_request_var('cutoff_octets');
}
$action = '';
if (isset_request_var('action')) {
$action = get_nfilter_request_var('action');
}
$stat_report = '0';
if (isset_request_var('stat_report')) {
$stat_report = get_nfilter_request_var('stat_report');
}
$flow_select = '1';
if (isset_request_var('flow_select')) {
$flow_select = get_nfilter_request_var('flow_select');
}
$print_report = '0';
if (isset_request_var('print_report')) {
$print_report = get_nfilter_request_var('print_report');
}
$resolve_addresses = 'Y';
if (isset_request_var('resolve_addresses')) {
$resolve_addresses = get_nfilter_request_var('resolve_addresses');
}
}
?>