view doc/ucis.ano/bgp_graph/bgp_path_list_quagga.php @ 538:3247a742e3f8 draft

peer2anonet: Sun Jul 10 07:25:42 CDT 2011 - d3v1150m471c * security checks, whitespace removed after some data
author d3v1150m471c <d3v11@d3v1150m471c.ano>
date Sun, 10 Jul 2011 07:26:48 -0500
parents 4dbe5bf653bb
children
line wrap: on
line source

#!/usr/bin/php
<?php
$sock = fsockopen('localhost', 2605);
fread($sock, 1024);
fwrite($sock, "insecure\n");
fwrite($sock, "show ip bgp paths\n");
fwrite($sock, "quit\n");
while (!feof($sock)) {
	$line = stream_get_line($sock, 1024, "\r\n");
	if ($line === NULL || $line === FALSE) break;
	if (!strlen($line) || $line[0] != '[') continue;
	$pos = strpos($line, ') ');
	if ($pos === FALSE) continue;
	if ($pos == strlen($line) - 2) continue;
	print(substr($line, $pos+2)."\n");
}