diff --git a/disableSeLinux.sh b/contrib/disableSeLinux.sh similarity index 100% rename from disableSeLinux.sh rename to contrib/disableSeLinux.sh diff --git a/installAS-Stats.sh b/contrib/installAS-Stats.sh similarity index 100% rename from installAS-Stats.sh rename to contrib/installAS-Stats.sh diff --git a/www/config.inc b/www/config.inc index ce91ac6..3060005 100644 --- a/www/config.inc +++ b/www/config.inc @@ -18,7 +18,9 @@ $hidelinkusagename = true; # $showtitledetail will need to be true to allow t $whois = "/usr/bin/whois"; $assetpath = "asset"; -$asset_cache_life ="604800"; # 604800 seconds = 7 days +$asset_cache_life = "604800"; # 604800 seconds = 7 days + +$compat_rrdtool12 = false; # compatibility with RRDtool 1.2 (show95th will not work if this is set) /* Custom links to be shown for each AS. You can use %as% as a placeholder for the ASN. */ diff --git a/www/gengraph.php b/www/gengraph.php index 5df1d78..03b780f 100644 --- a/www/gengraph.php +++ b/www/gengraph.php @@ -31,12 +31,12 @@ $cmd = "$rrdtool graph - " . "--color BACK#ffffff00 --color SHADEA#ffffff00 --color SHADEB#ffffff00 "; if($outispositive) - $cmd .= "--vertical-label '<- IN | OUT ->' "; + $cmd .= "--vertical-label '<- IN | OUT ->' "; else - $cmd .= "--vertical-label '<- OUT | IN ->' "; + $cmd .= "--vertical-label '<- OUT | IN ->' "; if($showtitledetail && $_GET['dname'] != "") - $cmd .= "--title " . str_replace(' ','\ ',rawurldecode($_GET['dname'])) . " "; + $cmd .= "--title " . escapeshellarg($_GET['dname']) . " "; else if (isset($_GET['v']) && is_numeric($_GET['v'])) $cmd .= "--title IPv" . $_GET['v'] . " "; @@ -56,39 +56,52 @@ foreach ($knownlinks as $link) { $cmd .= "DEF:{$link['tag']}_{$v6_el}out=\"$rrdfile\":{$link['tag']}_{$v6_el}out:AVERAGE "; } -$tot_in_bits = "CDEF:tot_in_bits=0"; -$tot_out_bits = "CDEF:tot_out_bits=0"; - -/* generate a CDEF for each DEF to multiply by 8 (bytes to bits), and reverse for outbound */ -foreach ($knownlinks as $link) { - $cmd .= "CDEF:{$link['tag']}_{$v6_el}in_bits_pos={$link['tag']}_{$v6_el}in,8,* "; - $cmd .= "CDEF:{$link['tag']}_{$v6_el}out_bits_pos={$link['tag']}_{$v6_el}out,8,* "; - $tot_in_bits .= ",{$link['tag']}_{$v6_el}in_bits_pos,ADDNAN"; - $tot_out_bits .= ",{$link['tag']}_{$v6_el}out_bits_pos,ADDNAN"; -} - -$cmd .= "$tot_in_bits "; -$cmd .= "$tot_out_bits "; - -$cmd .= "VDEF:tot_in_bits_95th_pos=tot_in_bits,95,PERCENT "; -$cmd .= "VDEF:tot_out_bits_95th_pos=tot_out_bits,95,PERCENT "; - -if ($outispositive) { - $cmd .= "CDEF:tot_in_bits_95th=tot_in_bits,POP,tot_in_bits_95th_pos,-1,* "; - $cmd .= "CDEF:tot_out_bits_95th=tot_out_bits,POP,tot_out_bits_95th_pos,1,* "; +if ($compat_rrdtool12) { + /* generate a CDEF for each DEF to multiply by 8 (bytes to bits), and reverse for outbound */ + foreach ($knownlinks as $link) { + if ($outispositive) { + $cmd .= "CDEF:{$link['tag']}_{$v6_el}in_bits={$link['tag']}_{$v6_el}in,-8,* "; + $cmd .= "CDEF:{$link['tag']}_{$v6_el}out_bits={$link['tag']}_{$v6_el}out,8,* "; + } else { + $cmd .= "CDEF:{$link['tag']}_{$v6_el}in_bits={$link['tag']}_{$v6_el}in,8,* "; + $cmd .= "CDEF:{$link['tag']}_{$v6_el}out_bits={$link['tag']}_{$v6_el}out,-8,* "; + } + } } else { - $cmd .= "CDEF:tot_in_bits_95th=tot_in_bits,POP,tot_in_bits_95th_pos,1,* "; - $cmd .= "CDEF:tot_out_bits_95th=tot_out_bits,POP,tot_out_bits_95th_pos,-1,* "; -} + $tot_in_bits = "CDEF:tot_in_bits=0"; + $tot_out_bits = "CDEF:tot_out_bits=0"; -foreach ($knownlinks as $link) { - if ($outispositive) { - $cmd .= "CDEF:{$link['tag']}_{$v6_el}in_bits={$link['tag']}_{$v6_el}in_bits_pos,-1,* "; - $cmd .= "CDEF:{$link['tag']}_{$v6_el}out_bits={$link['tag']}_{$v6_el}out_bits_pos,1,* "; - } else { - $cmd .= "CDEF:{$link['tag']}_{$v6_el}out_bits={$link['tag']}_{$v6_el}out_bits_pos,-1,* "; - $cmd .= "CDEF:{$link['tag']}_{$v6_el}in_bits={$link['tag']}_{$v6_el}in_bits_pos,1,* "; - } + /* generate a CDEF for each DEF to multiply by 8 (bytes to bits), and reverse for outbound */ + foreach ($knownlinks as $link) { + $cmd .= "CDEF:{$link['tag']}_{$v6_el}in_bits_pos={$link['tag']}_{$v6_el}in,8,* "; + $cmd .= "CDEF:{$link['tag']}_{$v6_el}out_bits_pos={$link['tag']}_{$v6_el}out,8,* "; + $tot_in_bits .= ",{$link['tag']}_{$v6_el}in_bits_pos,ADDNAN"; + $tot_out_bits .= ",{$link['tag']}_{$v6_el}out_bits_pos,ADDNAN"; + } + + $cmd .= "$tot_in_bits "; + $cmd .= "$tot_out_bits "; + + $cmd .= "VDEF:tot_in_bits_95th_pos=tot_in_bits,95,PERCENT "; + $cmd .= "VDEF:tot_out_bits_95th_pos=tot_out_bits,95,PERCENT "; + + if ($outispositive) { + $cmd .= "CDEF:tot_in_bits_95th=tot_in_bits,POP,tot_in_bits_95th_pos,-1,* "; + $cmd .= "CDEF:tot_out_bits_95th=tot_out_bits,POP,tot_out_bits_95th_pos,1,* "; + } else { + $cmd .= "CDEF:tot_in_bits_95th=tot_in_bits,POP,tot_in_bits_95th_pos,1,* "; + $cmd .= "CDEF:tot_out_bits_95th=tot_out_bits,POP,tot_out_bits_95th_pos,-1,* "; + } + + foreach ($knownlinks as $link) { + if ($outispositive) { + $cmd .= "CDEF:{$link['tag']}_{$v6_el}in_bits={$link['tag']}_{$v6_el}in_bits_pos,-1,* "; + $cmd .= "CDEF:{$link['tag']}_{$v6_el}out_bits={$link['tag']}_{$v6_el}out_bits_pos,1,* "; + } else { + $cmd .= "CDEF:{$link['tag']}_{$v6_el}out_bits={$link['tag']}_{$v6_el}out_bits_pos,-1,* "; + $cmd .= "CDEF:{$link['tag']}_{$v6_el}in_bits={$link['tag']}_{$v6_el}in_bits_pos,1,* "; + } + } } /* generate graph area/stack for inbound */ @@ -120,11 +133,11 @@ foreach ($knownlinks as $link) { $i++; } -if($show95th){ - $cmd .= "LINE1:tot_in_bits_95th#FF0000 "; - $cmd .= "LINE1:tot_out_bits_95th#FF0000 "; - $cmd .= "GPRINT:tot_in_bits_95th_pos:'95th in %6.2lf%s' "; - $cmd .= "GPRINT:tot_out_bits_95th_pos:'95th out %6.2lf%s' "; +if ($show95th && !$compat_rrdtool12) { + $cmd .= "LINE1:tot_in_bits_95th#FF0000 "; + $cmd .= "LINE1:tot_out_bits_95th#FF0000 "; + $cmd .= "GPRINT:tot_in_bits_95th_pos:'95th in %6.2lf%s' "; + $cmd .= "GPRINT:tot_out_bits_95th_pos:'95th out %6.2lf%s' "; } # zero line diff --git a/www/headermenu.inc b/www/headermenu.inc index 79d716e..7db9fb7 100644 --- a/www/headermenu.inc +++ b/www/headermenu.inc @@ -1,24 +1,24 @@ Top AS | Top AS | 4 Hour | 4 Hour | 4 Hour | 4 Hour | 12 Hour | 12 Hour | 12 Hour | 12 Hour | 200) $topas = getasstats_top($ntop); +if (@$_GET['numhours']) { + $start = time() - $_GET['numhours']*3600; + $end = time(); +} else { + $start = ""; + $end = ""; +} + ?> @@ -81,10 +89,10 @@ echo join(" | ", $htmllinks);
-
-
-
- IPv4: ~ in /
- out in the last 24 hours
-
- IPv6: ~ in /
- out in the last 24 hours
-
-
-
-
- $url) {
- $url = str_replace("%as%", $as, $url);
- $htmllinks[] = "" . htmlspecialchars($linkname) . "\n";
-}
-echo join(" | ", $htmllinks);
-?>
-
-
-
-
- #
-
- |
-
-
- |
-
---|
";
-
- echo "
| " . $link['descr'] . " | \n"; -} -?> -
-
-
-
- IPv4: ~ in /
- out in the last 24 hours
-
- IPv6: ~ in /
- out in the last 24 hours
-
-
-
-
- $url) {
- $url = str_replace("%as%", $as, $url);
- $htmllinks[] = "" . htmlspecialchars($linkname) . "\n";
-}
-echo join(" | ", $htmllinks);
-?>
-
-
-
-
- #
-
- |
-
-
- |
-
---|
";
-
- echo "
| " . $link['descr'] . " | \n"; -} -?> -