forked from rohammer/Simple-Babelweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.html
executable file
·142 lines (132 loc) · 3.15 KB
/
babel.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/haserl
<%
echo -en "Content-Type: text/html\r\n\r\n"
HOSTNAME="$(uci -q get "fff.system.hostname")"
lockfile="/tmp/simple.babelweb.lock"
if [ -e $lockfile ];then
if [ 30 -gt $(( $(date +%s) - $(date -r $lockfile +%s) )) ];then
echo "only one access per minute!!" && exit
fi
fi
data=$(echo "dump" | nc ::1 33123)
touch $lockfile
%><!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>
<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>
<input type="text" size="17" name="ip">
<button type="submit" name="weg" value="1">Wege zur IP Adresse</button>
</form>
<br />
<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>
<br />
<%
if ! [ ${GET_routes} ] && ! [ ${GET_v4table} ] && ! [ ${GET_v6table} ] && ! [ ${GET_weg} ] ; then
%>
<H2>Interfaces</H2>
<%
echo "$data" | grep interface | while read line ; do
echo "$line"
echo "<br>"
done
%>
<br />
<H2>Neighbours</H2>
<%
echo "$data" | grep neighbour | while read line ; do
echo $line
echo "<br>"
done
%>
<br />
<H2>Redistributed routes</H2>
<%
echo "$data" | grep xroute | while read line ; do
echo $line
echo "<br>"
done
%>
<%
fi
echo "<table>"
if [ ${GET_routes} ]; then
%>
<H2>All routes</H2>
<%
echo "$data" | grep -w route | while read line ; do
echo "<tr><td>$line</td></tr>"
done
fi
if [ ${GET_v4table} ]; then
%>
<H2>Show IPv6 Routing Tabele</H2>
<%
v4routen=$(ip ro sh tab 10)
echo "$v4routen" | while read line ; do
echo "<tr><td>$line</td></tr>"
done
fi
if [ ${GET_v6table} ]; then
%>
<H2>Show IPv6 Routing Tabele</H2>
<%
v6routen=$(ip -6 ro sh tab 10)
echo "$v6routen" | while read line ; do
echo "<tr><td>$line</td></tr>"
done
fi
if [ ${GET_weg} ]; then
%>
<H2>Wege zu <%# echo ${GET_ip} %></H2>
<%
echo "$data" | grep -w route | grep "${GET_ip}" | while read line ; do
echo "<tr><td>$line</td></tr>"
done
fi
%>
</table>
</body>
</html>