#!/bin/sh PASSWORD="FooBar" echo "Content-Type: application/xhtml+xml; charset=UTF-8" echo "" ASNO="" if printf %d "$1" &> /dev/null ; then ASNO=`printf %d "$1"` fi if [ $ASNO -le 0 ]; then ASNO=""; fi echo '' echo '' echo '' echo "" echo "BGP Looking glass AS64692" echo '' echo "" echo "" echo "

Routeglass AS64692 dn42

" echo '

IPv4 IPv6

' if [ "$ASNO" != "" ]; then echo "

Filtered to AS $ASNO. To see all, go here.

"; IP4CMD="${PASSWORD}\nshow ip bgp regexp _$ASNO\$\nquit\n" IP6CMD="${PASSWORD}\nshow ipv6 bgp regexp _$ASNO\$\nquit\n" else echo "

Unfiltered.

" echo "

To see only routes originating from say AS 64645, append ?64645 to the URL

" IP4CMD="${PASSWORD}\nshow ip bgp\nquit\n" IP6CMD="${PASSWORD}\nshow ipv6 bgp\nquit\n" fi echo "

IPv4

" echo "
"
echo -e ${IP4CMD} \
	| nc 127.0.0.1 2605 \
	| sed -n '/BGP table/,/Total number/ p'
echo "
" echo "

IPv6

" echo "
"
echo -e ${IP6CMD} \
	| nc 127.0.0.1 2605 \
	| sed -n '/BGP table/,/Total number/ p'
echo "
" echo "" echo ""