X-Git-Url: http://www.andromeda.nl/gitweb/?a=blobdiff_plain;f=src%2Fweb%2Fabuse.php;h=03347bf128f48e1269a5bb7e156eac4e617bd648;hb=a69891d161062fc79972962b569aa89ec8ad5eeb;hp=28eb373a8eb4163c3cd56bf9f183a5164f451096;hpb=2b2acb2d2da4a6a9196a4211e0058be3fb1c659c;p=gnucomo.git
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 "
Abused log entry | ||
---|---|---|
Time | Service | Abused log entry |
"; - //echo $log->rawdata; - echo $logid->logid; + echo $log->object_timestamp; + echo " | "; + echo $log->servicecode; + echo " | "; + echo $log->rawdata; echo " |