From a69891d161062fc79972962b569aa89ec8ad5eeb Mon Sep 17 00:00:00 2001 From: arjen Date: Fri, 19 Oct 2007 07:15:52 +0000 Subject: [PATCH] In the abuse list, IP addresses can be whitelisted. --- src/web/abuse.php | 56 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/src/web/abuse.php b/src/web/abuse.php index 28eb373..03347bf 100644 --- a/src/web/abuse.php +++ b/src/web/abuse.php @@ -9,7 +9,7 @@ *********************** ** FILE NAME : abuse.php ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring -** VERSION NUMBER : $Revision: 1.2 $ +** VERSION NUMBER : $Revision: 1.3 $ ** ** DESCRIPTION : Abuse list page ** @@ -27,7 +27,10 @@ /***************************** $Log: abuse.php,v $ - Revision 1.2 2007-01-11 13:44:29 arjen + Revision 1.3 2007-10-19 07:15:52 arjen + In the abuse list, IP addresses can be whitelisted. + + Revision 1.2 2007/01/11 13:44:29 arjen Manually edit parameters. View logs from abusing IP addresses. @@ -36,7 +39,7 @@ ******************************/ -// RCSID = "$Id: abuse.php,v 1.2 2007-01-11 13:44:29 arjen Exp $"; +// RCSID = "$Id: abuse.php,v 1.3 2007-10-19 07:15:52 arjen Exp $"; ini_set('include_path', '.:./classes:../phpclasses'); @@ -66,7 +69,7 @@ class abuse_list extends page { echo "$Source_IP is new.
"; pg_exec($this->database, "INSERT INTO object_abuse VALUES ('" . $_GET['oid'] . - "', '$Source_IP', '$abuse_points')"); + "', '$Source_IP', '$abuse_points', '', NOW())"); } else { @@ -75,7 +78,7 @@ class abuse_list extends page echo $Source_IP . " will get " . $abuse_points . " abuse points.
"; echo "Status was " . $abuse->status . "
"; pg_exec($this->database, "UPDATE object_abuse SET nr_abuses='$abuse_points'" . - " WHERE objectid='" . $_GET['oid'] . "' AND source='$Source_IP'"); + ", last_change=NOW() WHERE objectid='" . $_GET['oid'] . "' AND source='$Source_IP'"); if ($abuse_points >= 6) { @@ -87,6 +90,28 @@ class abuse_list extends page //select rawdata from log where logid in (select logid from log_abuse where source=''); } + else if (!empty($_POST['ACTION']) && $_POST['ACTION'] == 'Whitelist') + { + $Source_IP = $_POST['source']; + echo "Whitelisting " . $_POST['source'] . "
\n"; + $res = pg_exec($this->database, "SELECT * FROM object_abuse + WHERE objectid='". $_GET['oid'] ."' AND source='$Source_IP'"); + $Status = $_POST['status']; + if (pg_numrows($res) == 0) + { + echo "$Source_IP is new.
"; + pg_exec($this->database, "INSERT INTO object_abuse VALUES ('" . $_GET['oid'] . + "', '$Source_IP', 0, '$Status', NOW())"); + } + else + { + $abuse = pg_fetch_object($res, 0); + echo $Source_IP . " will be whitelisted.
"; + echo "Status was " . $abuse->status . "
"; + pg_exec($this->database, "UPDATE object_abuse SET status='$Status'" . + ", last_change=NOW() WHERE objectid='" . $_GET['oid'] . "' AND source='$Source_IP'"); + } + } else if (!empty($_POST['ACTION']) && $_POST['ACTION'] == 'Investigate') { // Present a list of abuse addresses in one subnet @@ -123,23 +148,28 @@ class abuse_list extends page . "' AND source << '$Subnet'"); $abuse_points = 8; pg_exec($this->database, "INSERT INTO object_abuse VALUES ('" . $_GET['oid'] . - "', '$Subnet', '$abuse_points', 'dropped')"); + "', '$Subnet', '$abuse_points', 'dropped', NOW())"); } if (!empty($_GET['src'])) { $oid = $_GET['oid']; $src = $_GET['src']; - $res = pg_exec($this->database, "SELECT logid FROM log_abuse WHERE objectid=$oid AND source <<= '$src'"); + $res = pg_exec($this->database, "SELECT * FROM log WHERE logid IN + (SELECT logid FROM log_abuse WHERE objectid=$oid AND source <<= '$src') + ORDER BY object_timestamp"); echo ""; - echo ""; + echo ""; for ($row = 0; $row < pg_numrows($res); $row++) { - $logid = pg_fetch_object($res, $row); + $log = pg_fetch_object($res, $row); //$log = pg_fetch_object(pg_exec($this->database, "SELECT rawdata FROM log WHERE logid=" . $logid->logid), 0); echo ""; } echo "
Abused log entry
TimeServiceAbused log entry
"; - //echo $log->rawdata; - echo $logid->logid; + echo $log->object_timestamp; + echo ""; + echo $log->servicecode; + echo ""; + echo $log->rawdata; echo "
"; @@ -149,6 +179,8 @@ class abuse_list extends page echo "
"; echo "Report "; echo " for IP address "; + echo " or "; + echo " with status "; echo "
"; echo "
"; @@ -175,7 +207,7 @@ class abuse_list extends page echo ""; echo $abuse->status; echo ""; - echo $abuse->last_changed; + echo $abuse->last_change; echo ""; } echo ""; -- 2.11.0