ripeview.htm 3.9 KB

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