luci-app-banip: new package
[project/luci.git] / applications / luci-app-banip / luasrc / view / banip / ripeview.htm
1 <%#
2 Copyright 2018 Dirk Brenken (dev@brenken.org)
3 This is free software, licensed under the Apache License, Version 2.0
4 -%>
5
6 <%+header%>
7 <%+banip/banip_css%>
8
9 <script type="text/javascript">
10 //<![CDATA[
11 function ripe_desc()
12 {
13 var query = div_ripe.querySelector("#s_ripe").value;
14 var output = document.getElementById("ripe_desc");
15
16 switch (query) {
17 case "geoloc":
18 output.innerHTML = "<%:This data call returns geolocation information for the given IP space, or for announced IP prefixes in the case of ASNs.%>";
19 break;
20 case "as-overview":
21 output.innerHTML = "<%:This data call shows general informations about an ASN like its announcement status and the name of its holder according to the WHOIS service.%>";
22 break;
23 case "announced-prefixes":
24 output.innerHTML = "<%:This data call returns all announced prefixes for a given ASN.%>";
25 break;
26 case "network-info":
27 output.innerHTML = "<%:This data call returns the containing prefix and announcing ASN of a given IP address.%>";
28 break;
29 case "country-resource-list":
30 output.innerHTML = "<%:This data call lists the Internet resources associated with a country, including ASNs, IPv4 ranges and IPv4/6 CIDR prefixes.%>";
31 break;
32 case "whois":
33 output.innerHTML = "<%:This data call returns whois information from the relevant Regional Internet Registry and Routing Registry.%>";
34 break;
35 case "dns-chain":
36 output.innerHTML = "<%:This data call returns the recursive chain of DNS forward (A/AAAA/CNAME) and reverse (PTR) records starting form either a hostname or an IP address.%>";
37 break;
38 case "iana-registry-info":
39 output.innerHTML = "<%:This data call gives access to various data sources maintained by IANA.%>";
40 break;
41 default:
42 output.innerHTML = "";
43 }
44 }
45
46 function ripe_view()
47 {
48 var query = div_ripe.querySelector("#s_ripe").value;
49 var input = document.getElementById("ripe_input");
50 var view = document.getElementById("view_id");
51
52 if (!input.value)
53 {
54 return;
55 }
56 view.value = "<%:Loading ...%>";
57
58 new XHR().get('<%=luci.dispatcher.build_url("admin", "services", "banip")%>/ripeview/' + query + "/" + input.value, null,
59 function(x)
60 {
61 if (!x)
62 {
63 view.value = "<%:No response!%>";
64 return;
65 }
66 view.value = x.responseText;
67 });
68 }
69 window.onload = ripe_desc;
70 //]]>
71 </script>
72
73 <div class="cbi-map">
74 <div class="cbi-section">
75 <div class="cbi-section-descr"><%_The RIPEstat Data API is the public data interface provided by RIPE NCC, for details look <a href="https://stat.ripe.net/docs/data_api" target="_blank" rel="noopener noreferrer">here</a>.%></div>
76 <div class="cbi-section-node">
77 <div class="table cbi-section-table">
78 <div class="tr cbi-section-table-row">
79 <div class="td left">
80 <input class="cbi-input-text" style="width:20em" type="text" id="ripe_input" placeholder="<%:Enter IP/CIDR/ASN/ISO%>" value="" />
81 </div>
82 </div>
83 <div class="tr cbi-section-table-row" id="div_ripe">
84 <div class="td left">
85 <select id="s_ripe" class="cbi-input-select cbi-button" style="width:15em" onchange="ripe_desc()">
86 <option value="geoloc" selected="selected"><%:Geo Location%></option>
87 <option value="as-overview"><%:ASN Overview%></option>
88 <option value="announced-prefixes"><%:ASN Prefixes%></option>
89 <option value="network-info"><%:IP/ASN Mapping%></option>
90 <option value="country-resource-list"><%:Country Resources%></option>
91 <option value="whois"><%:Whois Information%></option>
92 <option value="dns-chain"><%:DNS Chain%></option>
93 <option value="iana-registry-info"><%:IANA Information%></option>
94 </select>
95 <input type="button" id="bt_load" value="<%:Load%>" onclick="ripe_view()" class="cbi-button cbi-button-add" /><br /><br />
96 <span class="ripe_desc" id="ripe_desc"></span>
97 </div>
98 </div>
99 </div>
100 </div>
101 <textarea id="view_id" readonly="readonly" wrap="off" value=""></textarea>
102 </div>
103 </div>
104
105 <%+footer%>