fixing things, adding better security

git-svn-id: http://www.observium.org/svn/observer/trunk@351 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-03-11 14:50:24 +00:00
parent 98b5917f27
commit b7c9a6eb11
9 changed files with 57 additions and 14 deletions

10
INSTALL
View File

@ -1,5 +1,5 @@
This software is currently Alpha, so no real documentation exists yes.
Please see http://www.observernms.org for some instructions.
Please also contact me via adama@memetic.org if you run in to any issues.
This software is currently Alpha, so no real documentation exists yet.
Please see http://www.observernms.org for some instructions.
Please also contact me via adama@memetic.org if you run in to any issues.

View File

@ -7,6 +7,8 @@
include("../config.php");
include("../includes/functions.php");
include("includes/authenticate.inc");
if(!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
require("includes/jpgraph/jpgraph.php");
include("includes/jpgraph/jpgraph_line.php");
include("includes/jpgraph/jpgraph_utils.inc.php");

View File

@ -9,8 +9,6 @@
include("../config.php");
include("../includes/functions.php");
include("includes/authenticate.inc");
if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; }

View File

@ -3,11 +3,7 @@
include("../config.php");
include("../includes/functions.php");
include("includes/authenticate.inc");
# ini_set('display_errors', 1);
# ini_set('display_startup_errors', 1);
# ini_set('log_errors', 1);
# ini_set('error_reporting', E_ALL);
if(!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
if(isset($_GET['device_id'])){

View File

@ -3,7 +3,6 @@
ini_set('allow_url_fopen', 0);
ini_set('display_errors', 0);
if($_GET[debug]) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
@ -14,6 +13,8 @@ if($_GET[debug]) {
include("../config.php");
include("../includes/functions.php");
include("includes/authenticate.inc");
if(!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
if($_GET['query'] && $_GET['cmd']) {
$host = $_GET['query'];

View File

@ -1,6 +1,8 @@
<?php
include("../config.php");
include("../includes/functions.php");
include("includes/authenticate.inc");
if (isset($_GET["dir"])) {
$dir = $_GET["dir"];

View File

@ -3,6 +3,7 @@
## ifDescr whitelist (used instead of ifName)
$config['ifdescr']['IOS'] = true;
##############################
# No changes below this line #
##############################

22
remove-deleted-interfaces.php Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/php
### Purge deleted interfaces from the database
<?
include("config.php");
include("includes/functions.php");
$query = mysql_query("SELECT * FROM interfaces AS I, devices as D WHERE I.device_id = D.device_id AND I.deleted = '1'");
while($interface = mysql_fetch_array($query)) {
mysql_query("DELETE from interfaces where interface_id = '" . $interface['interface_id'] . "'");
mysql_query("DELETE from `adjacencies` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
mysql_query("DELETE from `links` WHERE `src_if` = '" . $interface['interface_id'] . "'");
mysql_query("DELETE from `links` WHERE `dst_if` = '" . $interface['interface_id'] . "'");
mysql_query("DELETE from `ipaddr` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
echo("Removed interface " . $interface['ifDescr'] . " from " . $interface['hostname'] . "\n");
}
?>

21
renamehost.php Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/php
<?
include("config.php");
include("includes/functions.php");
# Remove a host and all related data from the system
if($argv[1] && $argv[2]) {
$host = strtolower($argv[1]);
$id = getidbyname($host);
if($id) {
renamehost($id, $argv[2]);
echo("Renamed $host\n");
} else {
echo("Host doesn't exist!\n");
}
} else {
echo("Host Rename Tool\nUsage: ./delhost.php <old hostname> <new hostname>\n");
}
?>