2018-08-23 15:53:32 +02:00
|
|
|
#!/usr/bin/haserl
|
|
|
|
|
|
|
|
<%
|
|
|
|
echo -en "Content-Type: text/html\r\n\r\n"
|
|
|
|
HOSTNAME="$(uci -q get "fff.system.hostname")"
|
|
|
|
|
|
|
|
data=$(echo "dump" | nc ::1 33123)
|
|
|
|
|
|
|
|
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
|
|
<title><%= ${HOSTNAME} %></title>
|
|
|
|
<link href="/style.css" rel="stylesheet" type="text/css" media="screen" />
|
|
|
|
<meta http-equiv="cache-control" content="no-cache" />
|
|
|
|
<meta http-equiv="pragma" content="no-cache" />
|
|
|
|
<meta http-equiv="expires" content="0" />
|
|
|
|
<style>
|
|
|
|
table {
|
|
|
|
font-family: monospace, sans-serif;
|
|
|
|
border-collapse: collapse;
|
|
|
|
}
|
|
|
|
td, th {
|
|
|
|
border: 1px solid #fddddd;
|
|
|
|
text-align: left;
|
|
|
|
padding: 1px;
|
|
|
|
padding-right: 10px;
|
|
|
|
}
|
|
|
|
tr:nth-child(even) {
|
|
|
|
background-color: #dddddd;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Simple Babelweb</h1>
|
2018-08-23 16:55:10 +02:00
|
|
|
<br />
|
|
|
|
<form action="babel.html" method="get">
|
|
|
|
<button type="submit" name="" value="">home</button>
|
|
|
|
<button type="submit" name="routes" value="1">show all babel routes</button>
|
|
|
|
<button type="submit" name="v4table" value="1">show import/export table ipv4</button>
|
|
|
|
<button type="submit" name="v6table" value="1">show import/export table ipv6</button>
|
|
|
|
</form>
|
|
|
|
<br />
|
2018-08-23 15:53:32 +02:00
|
|
|
<H2>Babel information</H2>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td><% echo "$data" | head -n 1 %> </td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><% echo "$data" | head -n 2 | tail -n 1 %> </td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><% echo "$data" | head -n 3 | tail -n 1 %> </td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><% echo "$data" | head -n 4 | tail -n 1 %> </td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
</table>
|
2018-08-23 16:55:10 +02:00
|
|
|
<br />
|
|
|
|
|
|
|
|
<%
|
|
|
|
if ! [ ${GET_routes} ] && ! [ ${GET_v4table} ] && ! [ ${GET_v6table} ]; then
|
|
|
|
%>
|
2018-08-23 15:53:32 +02:00
|
|
|
|
|
|
|
<H2>Interfaces</H2>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>Interface</th>
|
|
|
|
<th>up</th>
|
|
|
|
<th>ipv6</th>
|
|
|
|
<th>ipv4</th>
|
|
|
|
</tr>
|
|
|
|
<%
|
|
|
|
echo "$data" | grep interface | while read line ; do
|
|
|
|
echo "<tr>"
|
|
|
|
echo "<td>"
|
2018-08-23 16:55:10 +02:00
|
|
|
echo ${line#*interface} | cut -d " " -f 1
|
2018-08-23 15:53:32 +02:00
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*up} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*ipv6} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*ipv4} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "</tr>"
|
|
|
|
done
|
2018-08-23 16:55:10 +02:00
|
|
|
%>
|
|
|
|
</table>
|
|
|
|
<br />
|
|
|
|
<H2>Neighbours</H2>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>address</th>
|
|
|
|
<th>interface</th>
|
|
|
|
<th>reach</th>
|
|
|
|
<th>rxcost</th>
|
|
|
|
<th>txcost</th>
|
|
|
|
<th>rtt</th>
|
|
|
|
<th>rttcost</th>
|
|
|
|
<th>cost</th>
|
|
|
|
</tr>
|
|
|
|
<%
|
|
|
|
echo "$data" | grep neighbour | while read line ; do
|
|
|
|
echo "<tr>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*address} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*if} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*reach} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*rxcost} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*txcost} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*rtt} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*rttcost} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*cost} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "</tr>"
|
|
|
|
done
|
|
|
|
%>
|
|
|
|
</table>
|
|
|
|
<br />
|
|
|
|
<H2>Redistributed routes</H2>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>prefix</th>
|
|
|
|
<th>metric</th>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<%
|
|
|
|
echo "$data" | grep xroute | while read line ; do
|
|
|
|
echo "<tr>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*prefix} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*metric} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "</tr>"
|
|
|
|
done
|
|
|
|
%>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
<%
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${GET_routes} ]; then
|
|
|
|
%>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>target</th>
|
|
|
|
<th>installed</th>
|
|
|
|
<th>via</th>
|
|
|
|
<th>device</th>
|
|
|
|
<th>metric</th>
|
|
|
|
<th>Destination ID</th>
|
|
|
|
</tr>
|
|
|
|
<%
|
|
|
|
echo "$data" | grep route | grep -v xroute | while read line ; do
|
|
|
|
echo "<tr>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*prefix} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*installed} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*via} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*if} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*metric} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*id} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "</tr>"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
%>
|
|
|
|
</table>
|
|
|
|
<%
|
|
|
|
if [ ${GET_v4table} ]; then
|
|
|
|
%>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>target</th>
|
|
|
|
<th>via</th>
|
|
|
|
<th>dev</th>
|
|
|
|
</tr>
|
|
|
|
<%
|
|
|
|
v4routen=$(ip ro sh tab 10)
|
|
|
|
echo "$v4routen" | while read line ; do
|
|
|
|
echo "<tr>"
|
|
|
|
echo "<td>"
|
|
|
|
echo $line | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*via} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*dev} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "</tr>"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
%>
|
|
|
|
</table>
|
|
|
|
<%
|
|
|
|
|
|
|
|
if [ ${GET_v6table} ]; then
|
|
|
|
%>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th>Destination</th>
|
|
|
|
<th>Source Specific</th>
|
|
|
|
<th>via</th>
|
|
|
|
<th>Device</th>
|
|
|
|
<th>Kernelmetric</th>
|
|
|
|
</tr>
|
|
|
|
<%
|
|
|
|
v6routen=$(ip -6 ro sh tab 10)
|
|
|
|
echo "$v6routen" | while read line ; do
|
|
|
|
echo "<tr>"
|
|
|
|
echo "<td>"
|
|
|
|
echo $line | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*from} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*via} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*dev} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "<td>"
|
|
|
|
echo ${line#*metric} | cut -d " " -f 1
|
|
|
|
echo "</td>"
|
|
|
|
echo "</tr>"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
%>
|
2018-08-23 15:53:32 +02:00
|
|
|
</table>
|
|
|
|
</body>
|
|
|
|
</html>
|