aboutsummaryrefslogtreecommitdiffstats
path: root/config/arpwatch
diff options
context:
space:
mode:
Diffstat (limited to 'config/arpwatch')
-rwxr-xr-xconfig/arpwatch/arpwatch_reports.php132
1 files changed, 70 insertions, 62 deletions
diff --git a/config/arpwatch/arpwatch_reports.php b/config/arpwatch/arpwatch_reports.php
index 9b3b1c6c..c1ab376f 100755
--- a/config/arpwatch/arpwatch_reports.php
+++ b/config/arpwatch/arpwatch_reports.php
@@ -1,61 +1,65 @@
#!/usr/local/bin/php
<?php
/*
- $Id$
+ arpwatch_reports.php
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2005 Colin Smith
+ Copyright (C) 2007-2015 ESF, LLC
+ All rights reserved.
- arpwatch_reports.php
- Copyright (C) 2005 Colin Smith
- All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 2. 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.
- 2. 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.
-
- THIS SOFTWARE IS PROVIDED ``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
- AUTHOR 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.
+ THIS SOFTWARE IS PROVIDED ``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
+ AUTHOR 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.
*/
-
require_once("guiconfig.inc");
require_once("service-utils.inc");
$logfile = "/var/log/arp.dat";
if ($_POST['clear']) {
- stop_service("arpwatch");
+ conf_mount_rw();
+ stop_service("arpwatch");
unlink_if_exists($logfile);
touch($logfile);
start_service("arpwatch");
+ conf_mount_ro();
}
-if(file_exists($logfile)) {
+if (file_exists($logfile)) {
$rawrep = file($logfile);
- foreach($rawrep as $line) {
- $todo = preg_split('/\s/', $line);
+ foreach ($rawrep as $line) {
+ $todo = preg_split('/\s/', $line);
$rawmac = explode(":", trim($todo[0]));
- foreach($rawmac as $set) $mac[] = str_pad($set, 2, "0", STR_PAD_LEFT);
+ foreach ($rawmac as $set) {
+ $mac[] = str_pad($set, 2, "0", STR_PAD_LEFT);
+ }
$newmac = implode(":", $mac);
- $report[$todo[1]][] = array(
- "mac" => $newmac,
- "timestamp" => trim($todo[2]),
- "hostname" => trim($todo[3]) ? trim($todo[3]) : "Unknown"
- );
+ $report[$todo[1]][] = array(
+ "mac" => $newmac,
+ "timestamp" => trim($todo[2]),
+ "hostname" => trim($todo[3]) ? trim($todo[3]) : "Unknown"
+ );
unset($mac);
}
}
+
$pgtitle = "arpwatch: Reports";
include("head.inc");
@@ -64,23 +68,23 @@ include("head.inc");
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>
+ <tr>
+ <td>
<?php
- $tab_array = array();
- $tab_array[] = array("Settings", false, "pkg_edit.php?xml=arpwatch.xml&id=0");
+ $tab_array = array();
+ $tab_array[] = array("Settings", false, "pkg_edit.php?xml=arpwatch.xml&id=0");
$tab_array[] = array("Reports", true, "arpwatch_reports.php");
display_top_tabs($tab_array);
?>
- </td>
- </tr>
- <tr>
- <td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td colspan="4" class="listtopic">arp.dat entries</td>
- </tr>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td colspan="4" class="listtopic">arp.dat entries</td>
+ </tr>
<tr>
<td width="15%" class="listhdrr">IP</td>
<td width="25%" class="listhdrr">Timestamp</td>
@@ -88,14 +92,14 @@ include("head.inc");
<td width="45%" class="listhdrr">Hostname</td>
</tr>
<?php
- if($report)
- foreach($report as $ip => $rawentries) {
+ if ($report) {
+ foreach ($report as $ip => $rawentries) {
$printip = true;
$entries = $rawentries;
sort($entries);
- foreach($entries as $entry) {
+ foreach ($entries as $entry) {
echo '<tr>';
- if($printip) {
+ if ($printip) {
echo '<td class="listlr">' . $ip . '</td>';
$stampclass = "listr";
$printip = false;
@@ -111,17 +115,21 @@ include("head.inc");
echo '</tr>';
}
}
+ }
?>
- <tr>
- <td>
- <br>
- <form action="arpwatch_reports.php" method="post">
- <input name="clear" type="submit" class="formbtn" value="Clear log">
- </form>
- </td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
+ <tr>
+ <td>
+ <br />
+ <form action="arpwatch_reports.php" method="post">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>