|
1 | 1 | <?php |
2 | 2 | /* |
3 | | -bro_monitor_data.php |
4 | | -part of pfSense (https://www.pfSense.org/) |
5 | | -Copyright (C) 2015-2016 Prosper Doko |
6 | | -All rights reserved. |
7 | | -
|
8 | | -Redistribution and use in source and binary forms, with or without |
9 | | -modification, are permitted provided that the following conditions are met: |
10 | | -
|
11 | | -1. Redistributions of source code must retain the above copyright notice, |
12 | | -this list of conditions and the following disclaimer. |
13 | | -
|
14 | | -2. Redistributions in binary form must reproduce the above copyright |
15 | | -notice, this list of conditions and the following disclaimer in the |
16 | | -documentation and/or other materials provided with the distribution. |
17 | | -
|
18 | | -THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
19 | | -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
20 | | -AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
21 | | -AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, |
22 | | -OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
23 | | -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
24 | | -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
25 | | -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
26 | | -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
27 | | -POSSIBILITY OF SUCH DAMAGE. |
| 3 | +* bro_monitor_data.php |
| 4 | +* part of pfSense (https://www.pfSense.org/) |
| 5 | +* Copyright (c) 2018 Prosper Doko |
| 6 | +* All rights reserved. |
| 7 | +* |
| 8 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | +* you may not use this file except in compliance with the License. |
| 10 | +* You may obtain a copy of the License at |
| 11 | +* |
| 12 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | +* |
| 14 | +* Unless required by applicable law or agreed to in writing, software |
| 15 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | +* See the License for the specific language governing permissions and |
| 18 | +* limitations under the License. |
28 | 19 | */ |
| 20 | + |
29 | 21 | require_once("guiconfig.inc"); |
30 | 22 |
|
31 | 23 | /* Requests */ |
32 | 24 | if ($_POST) { |
33 | 25 | global $program, $logfile; |
34 | | - // Actions |
35 | | - //$filter = preg_replace('/(@|!|>|<)/', "", htmlspecialchars($_POST['strfilter'])); |
| 26 | + |
36 | 27 | $program = strtolower($_POST['program']); |
37 | 28 | $logfile = $_POST['logfile']; |
38 | 29 |
|
|
45 | 36 |
|
46 | 37 | foreach ($loghead as $value) { |
47 | 38 | if (preg_match("/\bfields\b/", $value)) { |
48 | | - // $headfield = preg_split("/[\s,]+/", $value); |
49 | 39 | $headfield = preg_split("/[\t,]/", $value); |
50 | 40 | show_tds($headfield); |
51 | 41 | break; |
|
76 | 66 | /* Functions */ |
77 | 67 | function fetch_head($log) { |
78 | 68 | $log = escapeshellarg($log); |
79 | | - // Get logs based in filter expression |
| 69 | + // Get logs first 10 lines |
80 | 70 | exec("/usr/bin/head -n 10 {$log}", $loghead); |
81 | 71 | // Return logs head |
82 | 72 | return $loghead; |
|
0 commit comments