diff --git a/html/includes/.htaccess b/html/includes/.htaccess new file mode 100644 index 0000000000..8d2f25636d --- /dev/null +++ b/html/includes/.htaccess @@ -0,0 +1 @@ +deny from all diff --git a/html/map.php b/html/map.php new file mode 100755 index 0000000000..6e6ab7831a --- /dev/null +++ b/html/map.php @@ -0,0 +1,98 @@ + + +include("../config.php"); +include("../includes/functions.php"); + +$device = mysql_fetch_array(mysql_query("SELECT * from devices WHERE device_id = ".$_GET['device']."")); + +if($device && preg_match("/^[a-z]*$/", $_GET['format'])) { + +$map = "digraph G { sep=0.01; size=\"12,5.5\"; pack=100; bgcolor=transparent; splines=true; overlap=scale; concentrate=0; epsilon=0.001; rankdir=0; + node [ fontname=\"helvetica\", fontstyle=bold, style=filled, color=white, fillcolor=lightgrey, overlap=false;]; + edge [ bgcolor=white; fontname=\"helvetica\"; fontstyle=bold; arrowhead=dot; arrowtail=dot]; + graph [bgcolor=transparent;]; + +"; + +$map .= "\"".$device['hostname']."\" [fontsize=20 fillcolor=\"lightblue\" URL=\"/device/".$device['device_id']."/map/\" shape=box3d]\n"; + + +$sql = "SELECT * from interfaces AS I, links AS L WHERE I.device_id = ".$device['device_id']." AND L.src_if = I.interface_id"; +$links = mysql_query($sql); +while($link = mysql_fetch_array($links)) { + + $src_if = $link['src_if']; + $dst_if = $link['dst_if']; + + $i = 0; $done = 0; + while ($i < count($linkdone)) { + $thislink = "$dst_if $src_if"; + if ($linkdone[$i] == $thislink) { $done = 1; } + $i++; + } + + + + if(!$done) { + + $linkdone[] = "$src_if $dst_if"; + + if($link['ifSpeed'] >= "10000000000") { + $info = "color=lightred style=\"setlinewidth(8)\""; + } elseif ($link['ifSpeed'] >= "1000000000") { + $info = "color=lightblue style=\"setlinewidth(4)\""; + } elseif ($link['ifSpeed'] >= "100000000") { + $info = "color=lightgrey style=\"setlinewidth(2)\""; + } elseif ($link['ifSpeed'] >= "10000000") { + $info = "style=\"setlinewidth(1)\""; + } else { + $info = "style=\"setlinewidth(1)\""; + } + + $src = $device['hostname']; + $dst = mysql_result(mysql_query("SELECT `hostname` FROM `devices` AS D, `interfaces` AS I WHERE I.interface_id = '$dst_if' AND D.device_id = I.device_id"),0); + $dst_host = mysql_result(mysql_query("SELECT D.device_id FROM `devices` AS D, `interfaces` AS I WHERE I.interface_id = '$dst_if' AND D.device_id = I.device_id"),0); + + + $sif = makeshortif($link['ifDescr']); + $dif = makeshortif(mysql_result(mysql_query("SELECT ifDescr from interfaces WHERE interface_id = '".$dst_if."'"),0)); + + $map .= "\"$src$sif\" [label=\"$sif\", fontsize=12, fillcolor=lightblue URL=\"/device/".$device['device_id']."/interface/$src_if/\"]\n"; + $map .= "\"$src\" -> \"$src$sif\" [weight=500000, arrowsize=0, len=0];\n"; + +# $map .= "\"$src$sif\" -> \"$dst$dif\" [weight=1] \n"; + + $map .= "\"$dst\" [URL=\"/device/$dst_host/map/\" fontsize=20 shape=box3d]\n"; + + if($dst_host == $device['device_id']) { + $map .= "\"$dst$dif\" [label=\"$dif\", fontsize=12, fillcolor=lightblue, URL=\"/device/$dst_host/interface/$dst_if/\"]\n"; + } else { + $map .= "\"$dst$dif\" [label=\"$dif\", fontsize=12, fillcolor=lightgray, URL=\"/device/$dst_host/interface/$dst_if/\"]\n"; + } + + + $map .= "\"$dst$dif\" -> \"$dst\" [weight=500000, arrowsize=0, len=0];\n"; + + $map .= "\"$src$sif\" -> \"$dst$dif\" [weight=1, arrowhead=normal, arrowtail=normal, len=2, $info] \n"; + + } + +} + +$map .= " +};"; + +#echo("
$map"); + +$img = shell_exec("echo \"".addslashes($map)."\" | dot -T".$_GET['format'].""); +if($_GET['format'] == "png") { + header("Content-type: image/".$_GET['format']); +} elseif ($_GET['format'] == "svg") { + header("Content-type: image/svg+xml"); + $img = str_replace(" diff --git a/html/network/includes/.confirm_login.php.swp b/html/network/includes/.confirm_login.php.swp deleted file mode 100644 index e542b03859..0000000000 Binary files a/html/network/includes/.confirm_login.php.swp and /dev/null differ diff --git a/html/network/includes/.login.inc.php.swo b/html/network/includes/.login.inc.php.swo deleted file mode 100644 index e4331bcd51..0000000000 Binary files a/html/network/includes/.login.inc.php.swo and /dev/null differ diff --git a/html/network/includes/.login.inc.php.swp b/html/network/includes/.login.inc.php.swp deleted file mode 100644 index f8e57a0a5e..0000000000 Binary files a/html/network/includes/.login.inc.php.swp and /dev/null differ diff --git a/html/network/includes/authenticate.inc b/html/network/includes/authenticate.inc deleted file mode 100644 index 1fb38e34b9..0000000000 --- a/html/network/includes/authenticate.inc +++ /dev/null @@ -1,40 +0,0 @@ - diff --git a/html/network/includes/hostbox.inc b/html/network/includes/hostbox.inc deleted file mode 100644 index 14adee4804..0000000000 --- a/html/network/includes/hostbox.inc +++ /dev/null @@ -1,30 +0,0 @@ -$device[hostname]"); - if($device[location] != "") { $locationhtml = $device[location]; } - - $type = strtolower($device['os']); - if(file_exists("..images/os/$type" . ".gif")){ $image = "
-
$image $device[os] $device[version] ($device[features])
-
$locationhtml
- Up " . formatUptime($device[uptime]) ."
- ![]() |
- - |
- ![]() |
-
- ![]() |
- - |
- ![]() |
-