3 * Provide a list of address to be blocked on the firewall
4 * One GET parameter "object=hostname' will select dropped addresses for
5 * that specific host. The default is to return dropped addresses for all hosts.
7 * A remote host can obtain the list of addresses with wget, for example:
9 * wget --quiet -O gnucomo-abuses --no-check-certificate https://www.andromeda.nl/gnucomo/dropped.php?object=chronon.soleus.nu
13 header('Content-Type: text/plain');
14 ini_set('include_path', '.:./classes:../phpclasses');
16 require_once('gnucomo_config.php');
18 //echo "client address = " . $_SERVER['REMOTE_ADDR'] . "\n";
20 $allowed_clients = array("82.161.249.49", "94.142.246.85");
21 //echo array_search($_SERVER['REMOTE_ADDR'], $allowed_clients);
24 if (array_search($_SERVER['REMOTE_ADDR'], $allowed_clients) !== FALSE)
26 $config = new gnucomo_config;
27 $config->read("gnucomo");
29 // A special user for accessing dropped addresses
32 $passw = "Gnuc0mo-Ab4se";
34 $database = pg_connect($config->Database($name, $passw));
36 $query = "select source from object_abuse where status='dropped' and family(source)=4";
38 if (!empty($_GET['object']))
40 $object_query = "SELECT objectid FROM object WHERE objectname='" . $_GET['object']."'";
41 $res = pg_exec($database, $object_query);
42 $obj = pg_fetch_object($res, 0);
44 $query .= " and objectid=" . $obj->objectid;
47 $query .= " order by source";
50 $res = pg_exec($database, $query);
52 for ($ip = 0; $ip < pg_num_rows($res); $ip++)
54 $abuse = pg_fetch_object($res, $ip);
61 echo "Permission denied.\n";