blob: 240dcf3f2b7ddd01f048ddb4d0c4393c48a5635d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/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");
}
|