$AS_PATH2<---;\n"; $ases = split(" ", $AS_PATH2); $count = 0; foreach ( $ases as $as ) { # foreach #$dot .= "... $as ...\n"; if ( $as != $myAS ) { # catch loops if ( $count == 0 ) { $dot .= "$myAS -- $as;\n$as -- $myAS;\n"; } else { $dot .= "$oldas -- $as;\n$as -- $oldas;\n"; } $oldas = $as; $count++; } # end catch loops } # end foreach } } } #$label .= "AS $myAS ($ip), "; $label .= "$myAS, "; } } putenv("TZ=UTC"); $label = "Generated at ".gmdate("Y-m-d H:i:s e").", from the data of\\nASes: "; // Specify routers and the ASN here getRoutes("50.6.0.1", 1005, "s0mep@ss"); getRoutes("50.7.0.1", 1006, "s0mep@ss"); getRoutes("50.8.0.1", 1007, "s0mep@ss"); $dotuniq = `echo "$dot" | sort | uniq`; if ( $format == "raw" ) { header("Content-type: text/plain"); die("$dotuniq"); } if ( $format == "png" ) { header("Content-type: image/png"); } else { header("Content-type: image/svg+xml"); } if ( $format == "png" ) { $dotformat = "png"; } else { $dotformat = "svg"; } print `echo "strict graph bgp {\ngraph [label=\"\l$label\"];\n$dotuniq\n}\n" | dot -T$dotformat`;