
my %FORM = &cgi_decode($incoming); ... $FORM{addr} =~ s/\s.*// if (($FORM{query} eq "ping") || ($FORM{query} eq "trace")); $FORM{addr} =~ s/[^\s\d\.:\w\-_\/\$]//g;  my $command = sprintf($query_cmd, $FORM{addr}); ... if ($FORM{addr} !~ /^[\w\.\^\$\-\/ ]*$/) { if ($FORM{addr} =~ /^[\w\.\^\$\-\:\/ ]*$/) { ... } else { &print_error("Illegal characters in parameter string"); } }  $FORM{addr} = "" if ($FORM{addr} =~ /^[ ]*$/); ... if ($query_cmd =~ /%s/) { &print_error("Parameter missing") if ($FORM{addr} eq ""); } else { &print_warning("No parameter needed") if ($FORM{addr} ne ""); } ... &run_command($FORM{router}, $router_list{$FORM{router}}, $command);  my %valid_query = ( "ios" => { "ipv4" => { "bgp" => "show ip bgp %s", "advertised-routes" => "show ip bgp neighbors %s advertised-routes", "summary" => "show ip bgp summary", "ping" => "ping %s", "trace" => "traceroute %s" }, ...   Router: sgm01rb 
 Command: show bgp regexp $ 13238
 Sat Dec 19 16: 30: 21.141 UTC
 BGP router identifier 10.146.0.1, local AS number 20485
 BGP generic scan interval 60 secs
 BGP table state: Active
 Table ID: 0x0 RD version: 0
 BGP main routing table version 2995757495
 BGP scan interval 60 secs
 Status codes: s suppressed, damped, history, valid,> best
               i - internal, r RIB-failure, S stale, N Nexthop-discard
 Origin codes: i - IGP, e - EGP,?  - incomplete
    Network Next Hop Metric LocPrf Weight Path
 Route Distinguisher: 20485: 1 (default for vrf internet)
 *> i5.45.192.0 / 18 10.78.0.6 1000 70 0 13238 i
 * i 10.99.0.8 1000 70 0 13238 i
 * 149.6.168.201 1000 70 0 174 13238 i
 * 166.63.220.185 1000 70 0 1273 9002 13238 i
 * 212.73.250.153 1000 60 0 3356 13238 i
 * 213.248.99.221 1000 70 0 1299 13238 i
 *> i5.45.194.0 / 24 10.78.0.6 1000 70 0 13238 i
 * i 10.99.0.8 1000 70 0 13238 i
 * 212.73.250.153 1000 60 0 3356 13238 i
 * 213.248.99.221 1000 70 0 1299 13238 i
 *> i5.45.196.0 / 24 10.78.0.6 1000 70 0 13238 i
 * i 10.99.0.8 1000 70 0 13238 i
 * 149.6.168.201 1000 70 0 174 13238 i
 * 166.63.220.185 1000 70 0 1273 9002 13238 i
 * 212.73.250.153 1000 60 0 3356 13238 i
 * 213.248.99.221 1000 70 0 1299 13238 i
 *> i5.45.202.0 / 24 10.78.0.6 1000 70 0 13238 i
 * i 10.99.0.8 1000 70 0 13238 i
 * 212.73.250.153 1000 60 0 3356 13238 i
 * 213.248.99.221 1000 70 0 1299 13238 i
 ...  Router: len244-bb.stv 
 Command: show ip bgp neigh
 BGP neighbor is 10.255.0.2, remote AS 3216, external link
   BGP version 4, remote router ID 79.104.32.226
   BGP state = Established, up for 1y5w
   Last read 00:00:40, last write 00:00:14, hold time is 180, keepalive interval is 60 seconds
   Neighbor sessions:
     1 active, is not multisession capable
   Neighbor capabilities:
     Route refresh: advertised and received (new)
     Four-octets ASN Capability: advertised and received
     Address family IPv4 Unicast: advertised and received
     Multisession Capability: advertised
   Message statistics:
     InQ depth is 0
     OutQ depth is 0
    
                          Sent Rcvd
     Opens: 1 1
     Notifications: 0 0
     Updates: 1,352
     Keepalives: 631466 635532
     Route Refresh: 0 0
     Total: 631468 635885
   Default minimum time between advertisement runs is 30 seconds
  For address family: IPv4 Unicast
   Session: 10.255.0.2
   BGP table version 182470946, neighbor version 182470946/0
   Output queue size: 0
   Index 77
   77 update-group member
   Incoming update prefix filter list is B2B-BRAS-IN
   Outgoing update filter list prefix is ​​DENY-ALL
   Slow-peer detection is disabled
   Slow-peer split-update-group dynamic is disabled
                                  Sent Rcvd
   Prefix activity: ---- ----
     Prefixes Current: 0 1 (Consumes 52 bytes)
     Prefixes Total: 0 176
     Implicit Withdraw: 0 0
     Explicit Withdraw: 0 175
     Used as bestpath: n / a 1
     Used as multipath: n / a 0
                                    Outbound inbound
   Local Policy Denied Prefixes: -------- -------
     prefix-list 16426 0
     Well-known Community: 126392327 n / a
     Bestpath from this peer: 347 n / a
     Suppressed due to dampening: 15381 n / a
     Invalid Path: 2886275 n / a
     Total: 129310756 0
   Maximum prefixes allowed 500
   Threshold for warning message 75%, restart interval 3 min
   Number of NLRIs in the update sent: max 0, min 0
   Last detected as dynamic slow peer: never
   Dynamic slow peer recovered: never
 Datagrams (max data segment is 1460 bytes):
 Rcvd: 1268112 (out of order: 0), with data: 635885, total data bytes: 12089768
 Sent: 1265174 (retransmit: 1 fastretransmit: 0), with data: 631468, total data bytes: 11997935
 ...
BGP router identifier 81.176.81.18, local AS number 8342 RIB entries 1052472, using 64 MiB of memory Peers 2, using 5024 bytes of memory Peer groups 1, using 16 bytes of memory Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up / Down State / PfxRcd 195.161.1.10 4 8342 42323357 15458 0 0 0 01w3d17h 574623 195.161.1.155 4 8342 43105981 15458 0 0 0 01w3d17h 574623 Total number of neighbors 2
Router: MSK-IX MX480 Command: ping count 5 detail do-not-fragment size 1200 8.8.8.8 PING 8.8.8.8 (8.8.8.8): 1200 data bytes 1208 bytes from 8.8.8.8 via xe-3/3 / 0.0: icmp_seq = 0 ttl = 60 time = 1.041 ms 1208 bytes from 8.8.8.8 via xe-3/3 / 0.0: icmp_seq = 1 ttl = 60 time = 0.964 ms 1208 bytes from 8.8.8.8 via xe-3/3 / 0.0: icmp_seq = 2 ttl = 60 time = 0.959 ms 1208 bytes from 8.8.8.8 via xe-3/3 / 0.0: icmp_seq = 3 ttl = 60 time = 32.190 ms 1208 bytes from 8.8.8.8 via xe-3/3 / 0.0: icmp_seq = 4 ttl = 60 time = 1.038 ms --- 8.8.8.8 ping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss round-trip min / avg / max / stddev = 0.959 / 7.238 / 32.190 / 12.476 ms ...
Source: https://habr.com/ru/post/273517/
All Articles