summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-banip/luasrc/view/banip/ripeview.htm
blob: 5d26ce95f1b1917bf39a0908a75206c92f74cb20 (plain)
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
<%#
Copyright 2018 Dirk Brenken (dev@brenken.org)
This is free software, licensed under the Apache License, Version 2.0
-%>

<%+header%>
<%+banip/banip_css%>

<script type="text/javascript">
//<![CDATA[
	function ripe_desc()
	{
		var div_ripe = document.getElementById("div_ripe");
		var query    = div_ripe.querySelector("#s_ripe").value;
		var output   = document.getElementById("ripe_desc");
		
		switch (query) {
			case "geoloc":
				output.innerHTML = "<%:This data call returns geolocation information for the given IP space, or for announced IP prefixes in the case of ASNs.%>";
			break;
			case "as-overview":
				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.%>";
			break;
			case "announced-prefixes":
				output.innerHTML = "<%:This data call returns all announced prefixes for a given ASN.%>";
			break;
			case "network-info":
				output.innerHTML = "<%:This data call returns the containing prefix and announcing ASN of a given IP address.%>";
			break;
			case "country-resource-list":
				output.innerHTML = "<%:This data call lists the Internet resources associated with a country, including ASNs, IPv4 ranges and IPv4/6 CIDR prefixes.%>";
			break;
			case "whois":
				output.innerHTML = "<%:This data call returns whois information from the relevant Regional Internet Registry and Routing Registry.%>";
			break;
			case "dns-chain":
				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.%>";
			break;
			case "iana-registry-info":
				output.innerHTML = "<%:This data call gives access to various data sources maintained by IANA.%>";
			break;
			default:
				output.innerHTML = "";
		}
	}

	function ripe_view()
	{
		var div_ripe = document.getElementById("div_ripe");
		var query    = div_ripe.querySelector("#s_ripe").value;
		var input    = document.getElementById("ripe_input");
		var view     = document.getElementById("view_id");

		if (!input.value)
		{
			return;
		}
		view.value = "<%:Loading ...%>";

		new XHR().get('<%=luci.dispatcher.build_url("admin", "services", "banip")%>/ripeview/' + query + "/" + input.value, null,
		function(x)
		{
		if (!x)
			{
				view.value = "<%:No response!%>";
				return;
			}
			view.value = x.responseText;
		});
	}
	window.onload = ripe_desc;
//]]>
</script>

<div class="cbi-map">
	<div class="cbi-section">
		<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>
		<div class="cbi-section-node">
			<div class="table cbi-section-table">
				<div class="tr cbi-section-table-row">
					<div class="td left">
						<input class="cbi-input-text" style="width:20em" type="text" id="ripe_input" placeholder="<%:Enter IP/CIDR/ASN/ISO%>" value="" />
					</div>
				</div>
				<div class="tr cbi-section-table-row" id="div_ripe">
					<div class="td left">
						<select id="s_ripe" class="cbi-input-select cbi-button" style="width:15em" onchange="ripe_desc()">
							<option value="geoloc" selected="selected"><%:Geo Location%></option>
							<option value="as-overview"><%:ASN Overview%></option>
							<option value="announced-prefixes"><%:ASN Prefixes%></option>
							<option value="network-info"><%:IP/ASN Mapping%></option>
							<option value="country-resource-list"><%:Country Resources%></option>
							<option value="whois"><%:Whois Information%></option>
							<option value="dns-chain"><%:DNS Chain%></option>
							<option value="iana-registry-info"><%:IANA Information%></option>
						</select>
						<input type="button" id="bt_load" value="<%:Load%>" onclick="ripe_view()" class="cbi-button cbi-button-add" /><br /><br />
						<span class="ripe_desc" id="ripe_desc"></span>
					</div>
				</div>
			</div>
		</div>
		<textarea id="view_id" readonly="readonly" wrap="off" value=""></textarea>
	</div>
</div>

<%+footer%>