add_firewall_ipset.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <!-- Begin toolbar -->
  2. <div class="l-center edit">
  3. <div class="l-sort clearfix">
  4. <div class="l-unit-toolbar__buttonstrip">
  5. <a class="ui-button cancel" dir="ltr" id="btn-back" href="/list/firewall/ipset/"><i class="fas fa-arrow-left status-icon blue"></i><?=_('Back');?></a>
  6. </div>
  7. <div class="l-unit-toolbar__buttonstrip float-right">
  8. <a href="#" class="ui-button" data-action="submit" data-id="vstobjects"><i class="fas fa-save status-icon purple"></i><?=_('Save');?></a>
  9. </div>
  10. </div>
  11. </div>
  12. <!-- End toolbar -->
  13. <div class="l-separator"></div>
  14. <div class="l-center animated fadeIn">
  15. <form id="vstobjects" name="v_add_ipset" method="post">
  16. <input type="hidden" name="token" value="<?=$_SESSION['token']?>" />
  17. <input type="hidden" name="ok" value="Add" />
  18. <table class="data mode-add">
  19. <tr class="data-add">
  20. <td class="data-dotted">
  21. <table class="data-col1">
  22. <tr>
  23. <td></td>
  24. </tr>
  25. </table>
  26. </td>
  27. <td class="data-dotted">
  28. <table class="data-col2" width="600px">
  29. <tr>
  30. <td class="step-top">
  31. <span class="page-title"><?=_('Adding Firewall Ipset List');?></span>
  32. </td>
  33. </tr>
  34. <tr>
  35. <td>
  36. <?php show_error_panel($_SESSION);?>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td class="vst-text step-top">
  41. <?=_('Ip List Name') ?>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td>
  46. <input type="text" size="20" class="vst-input" name="v_ipname" maxlength="255" value="<?=htmlentities(trim($v_ipname, "'"))?>">
  47. </td>
  48. </tr>
  49. <tr>
  50. <td class="vst-text step-top">
  51. <?=_('Data Source') ?> <span class="optional">(<?=_('url, script or file');?>)</span>
  52. </td>
  53. </tr>
  54. <tr>
  55. <td>
  56. <select class="vst-list" tabindex="-1" id="datasource_list" onchange="this.nextElementSibling.value=this.value">
  57. <option value="">clear</option>
  58. </select>
  59. <input type="text" size="20" class="vst-input vst-list-editor" name="v_datasource" maxlength="255" value="<?=htmlentities(trim($v_datasource, "'"))?>">
  60. </td>
  61. </tr>
  62. <tr>
  63. <td class="vst-text step-top">
  64. <?=_('Ip Version') ?>
  65. </td>
  66. </tr>
  67. <tr>
  68. <td>
  69. <select class="vst-list" name="v_ipver">
  70. <option value="v4" <?php if ((!empty($v_ipver)) && ( $v_ipver == "'v4'" )) echo 'selected'?>><?=_('ip v4');?></option>
  71. <option value="v6" <?php if ((!empty($v_ipver)) && ( $v_ipver == "'v6'" )) echo 'selected'?>><?=_('ip v6');?></option>
  72. </select>
  73. </td>
  74. </tr>
  75. <tr>
  76. <td class="vst-text step-top">
  77. <?=_('Autoupdate') ?>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td>
  82. <select class="vst-list" name="v_autoupdate">
  83. <option value="yes" <?php if ((!empty($v_autoupdate)) && ( $v_autoupdate == "'yes'" )) echo 'selected'?>><?=_('yes');?></option>
  84. <option value="no" <?php if ((!empty($v_autoupdate)) && ( $v_autoupdate == "'no'" )) echo 'selected'?>><?=_('no');?></option>
  85. </select>
  86. </td>
  87. </tr>
  88. </table>
  89. <table class="data-col2"></table>
  90. </td>
  91. </tr>
  92. </table>
  93. </form>
  94. </div>
  95. <script>
  96. var country_iplists = [
  97. <?php
  98. $country = array('ca' => 'Canada', 'cn' => 'China', 'fr' => 'French', 'de' => 'Germany', 'in' => 'India', 'nl' => 'Netherlands', 'ro' => 'Romania', 'ru' => 'Russia', 'es' => 'Spain', 'ch' => 'Switzerland', 'tr' => 'Turkey', 'ua' => 'Ukraine', 'uk' => 'United Kingdom', 'us' => 'United States');
  99. foreach($country as $iso =>$name){
  100. echo '{name: "[IPv4] Country - '.$name.'", source:"https://raw.githubusercontent.com/ipverse/rir-ip/master/country/'.$iso.'/ipv4-aggregated.txt"},'."\n";
  101. }
  102. ?>
  103. // Define IPv6 country lists
  104. /*
  105. <?php
  106. foreach($country as $iso =>$name){
  107. echo '{name: "[IPv6] Country - '.$name.'", source:"https://raw.githubusercontent.com/ipverse/rir-ip/master/country/'.$iso.'/ipv6-aggregated.txt"},'."\n";
  108. }
  109. ?>
  110. */
  111. ];
  112. var blacklist_iplists = [
  113. { name: "[IPv4] Block Malicious IPs", source: "script:/usr/local/hestia/install/deb/firewall/ipset/blacklist.sh" },
  114. /*
  115. {name: "[IPv6] Block Malicious IPs", source:"script:/usr/local/hestia/install/deb/firewall/ipset/blacklist.ipv6.sh"},
  116. */
  117. ];
  118. country_iplists.sort(function (a, b) {
  119. return a.name > b.name;
  120. });
  121. blacklist_iplists.sort(function (a, b) {
  122. return a.name > b.name;
  123. });
  124. $(function () {
  125. var targetelement = document.getElementById('datasource_list');
  126. // Blacklist
  127. var newEl = document.createElement("option");
  128. newEl.text = "<?=_('BLACKLIST') ?>";
  129. newEl.disabled = true;
  130. targetelement.appendChild(newEl);
  131. blacklist_iplists.forEach(iplist => {
  132. var newEl = document.createElement("option");
  133. newEl.text = iplist.name;
  134. newEl.value = iplist.source;
  135. targetelement.appendChild(newEl);
  136. });
  137. // IPVERSE
  138. var newEl = document.createElement("option");
  139. newEl.text = "<?=_('IPVERSE') ?>";
  140. newEl.disabled = true;
  141. targetelement.appendChild(newEl);
  142. country_iplists.forEach(iplist => {
  143. var newEl = document.createElement("option");
  144. newEl.text = iplist.name;
  145. newEl.value = iplist.source;
  146. targetelement.appendChild(newEl);
  147. });
  148. });
  149. </script>