| 1 |
<script type="text/javascript"> |
| 2 |
|
| 3 |
jQuery(document).ready(function ($) { |
| 4 |
|
| 5 |
jQuery('.firewall-logs__pagination').on('click', 'a.wtotem_pagination__number', function (e) { |
| 6 |
e.preventDefault(); |
| 7 |
jQuery('#waf_logs_wrap').addClass('wtotem_loader_spinner'); |
| 8 |
jQuery.post(ajaxurl, { |
| 9 |
action: 'wtotem_ajax', |
| 10 |
ajax_action: 'pagination', |
| 11 |
wtotem_page_nonce: '{{ page_nonce }}', |
| 12 |
service: 'firewall', |
| 13 |
current_page: jQuery(this).attr('data-page'), |
| 14 |
}, function (data) { |
| 15 |
jQuery('#waf_logs_wrap').removeClass('wtotem_loader_spinner').html(data.content); |
| 16 |
jQuery('.firewall-logs__pagination').html(data.pagination); |
| 17 |
jQuery('#wtotem_notifications').html(data.notifications); |
| 18 |
}); |
| 19 |
}); |
| 20 |
|
| 21 |
jQuery('#wtotem-request-copy').on('click', function(e) { |
| 22 |
let copy_text = $('#wt_payload').text(); |
| 23 |
try { |
| 24 |
navigator.clipboard.writeText(copy_text); |
| 25 |
} catch(err) { |
| 26 |
if(typeof document.execCommand == 'function') { |
| 27 |
var $tmp = $("<textarea>"); |
| 28 |
$("body").append($tmp); |
| 29 |
$tmp.val(copy_text).select(); |
| 30 |
document.execCommand("copy"); |
| 31 |
$tmp.remove(); |
| 32 |
} |
| 33 |
} |
| 34 |
}); |
| 35 |
|
| 36 |
jQuery('.wtotem_body').on('click', '.wtotem_firewall-log__show-more', function (e) { |
| 37 |
|
| 38 |
let data_info = jQuery.parseJSON( jQuery(this).attr('data-more') ); |
| 39 |
|
| 40 |
jQuery('#wt_user_ip').text(data_info.ip); |
| 41 |
jQuery('#wt_proxy_ip').text(data_info.proxy_ip); |
| 42 |
jQuery('#wt_source').text(data_info.source); |
| 43 |
jQuery('#wt_request').text(data_info.request); |
| 44 |
jQuery('#wt_user_agent').text(data_info.user_agent); |
| 45 |
jQuery('#wt_time').text(data_info.time); |
| 46 |
jQuery('#wt_type').text(data_info.type); |
| 47 |
jQuery('#wt_category').text(data_info.category); |
| 48 |
jQuery('#wt_country').text(data_info.country); |
| 49 |
jQuery('#wt_payload').text(data_info.payload); |
| 50 |
|
| 51 |
jQuery('#firewall-log-report').removeClass('d-none'); |
| 52 |
}); |
| 53 |
}); |
| 54 |
|
| 55 |
</script> |
| 56 |
|
| 57 |
<div class="wtotem_chart wt_card" id="firewall_data"> |
| 58 |
<div id="waf_chart_wrap"> |
| 59 |
{% include 'firewall_chart.html.twig' with {'chart': chart, 'days': days } %} |
| 60 |
</div> |
| 61 |
{% if page == 'firewall' %} |
| 62 |
<div class="wtotem_data"> |
| 63 |
<div class="wtotem_data__thead"> |
| 64 |
<div class="wtotem_data__tr"> |
| 65 |
<div class="wtotem_data__th wtotem_data_width_1"> |
| 66 |
{{ 'Type/IP'|trans }} |
| 67 |
</div> |
| 68 |
<div class="wtotem_data__th wtotem_data_width_2"> |
| 69 |
{{ 'Country'|trans }} |
| 70 |
</div> |
| 71 |
<div class="wtotem_data__th wtotem_data_width_3"> |
| 72 |
{{ 'Time'|trans }} |
| 73 |
</div> |
| 74 |
<div class="wtotem_data__th wtotem_data_width_4"> |
| 75 |
{{ 'Attack location'|trans }} |
| 76 |
</div> |
| 77 |
<div class="wtotem_data__th wtotem_data_width_6"> |
| 78 |
{{ 'Status'|trans }} |
| 79 |
</div> |
| 80 |
<div class="wtotem_data__th wtotem_data_width_6"> |
| 81 |
{{ 'Report'|trans }} |
| 82 |
</div> |
| 83 |
|
| 84 |
</div> |
| 85 |
</div> |
| 86 |
|
| 87 |
|
| 88 |
<div class="wtotem_data__tbody"> |
| 89 |
<div id="waf_logs_wrap"> |
| 90 |
{% include 'firewall_logs.html.twig' with {'logs': logs, 'page': page, 'has_next_page': has_next_page } %} |
| 91 |
</div> |
| 92 |
<div class="firewall-logs__pagination">{{ firewall_logs_pagination | raw }}</div> |
| 93 |
</div> |
| 94 |
|
| 95 |
</div> |
| 96 |
{% endif %} |
| 97 |
|
| 98 |
|
| 99 |
<div class="wtotem_chart__line"></div> |
| 100 |
</div> |
| 101 |
|
| 102 |
|
| 103 |
{% if page == 'firewall' %} |
| 104 |
<div class="popup-overlay d-none" id="firewall-log-report"> |
| 105 |
<div class="popup-content wt_card"> |
| 106 |
<div class="port-scanner-list"> |
| 107 |
<div class="port-scanner-list__header"> |
| 108 |
<div class="port-scanner-list__header--title">{{ host_name }}</div> |
| 109 |
<div class="port-scanner-list__header--close popup-overlay__close"> |
| 110 |
<img width="10px" height="10px" src="{{ images_path }}plus_dark.svg" class="svg-icon"> |
| 111 |
</div> |
| 112 |
</div> |
| 113 |
|
| 114 |
<section class="firewall-log-report"> |
| 115 |
<ul class="firewall-log-report__list"> |
| 116 |
<li class="firewall-log-report__item firewall-log-report__item--blue"> |
| 117 |
<p class="firewall-log-report__item-title">{{ 'Hostname'|trans }}:</p> |
| 118 |
<p class="firewall-log-report__item-value">{{ host_name }}</p> |
| 119 |
</li> |
| 120 |
<li class="firewall-log-report__item"> |
| 121 |
<p class="firewall-log-report__item-title">{{ 'IP'|trans }}:</p> |
| 122 |
<p class="firewall-log-report__item-value" id="wt_user_ip"></p> |
| 123 |
</li> |
| 124 |
<li class="firewall-log-report__item"> |
| 125 |
<p class="firewall-log-report__item-title">{{ 'Proxy IP'|trans }}:</p> |
| 126 |
<p class="firewall-log-report__item-value" id="wt_proxy_ip"></p> |
| 127 |
</li> |
| 128 |
<li class="firewall-log-report__item"> |
| 129 |
<p class="firewall-log-report__item-title">{{ 'Source'|trans }}:</p> |
| 130 |
<p class="firewall-log-report__item-value" id="wt_source">0</p> |
| 131 |
</li> |
| 132 |
<li class="firewall-log-report__item"> |
| 133 |
<p class="firewall-log-report__item-title">{{ 'Request'|trans }}:</p> |
| 134 |
<p class="firewall-log-report__item-value" id="wt_request"></p> |
| 135 |
</li> |
| 136 |
<li class="firewall-log-report__item"> |
| 137 |
<p class="firewall-log-report__item-value"> |
| 138 |
<span class="firewall-log-report__item-title">{{ 'User agent:'|trans }}</span> |
| 139 |
<span id="wt_user_agent"></span> |
| 140 |
</p> |
| 141 |
</li> |
| 142 |
<li class="firewall-log-report__item"> |
| 143 |
<p class="firewall-log-report__item-title">{{ 'Time'|trans }}:</p> |
| 144 |
<p class="firewall-log-report__item-value" id="wt_time"></p> |
| 145 |
</li> |
| 146 |
<li class="firewall-log-report__item"> |
| 147 |
<p class="firewall-log-report__item-title">{{ 'Type'|trans }}:</p> |
| 148 |
<p class="firewall-log-report__item-value" id="wt_type"></p> |
| 149 |
</li> |
| 150 |
<li class="firewall-log-report__item"> |
| 151 |
<p class="firewall-log-report__item-title">{{ 'Category'|trans }}:</p> |
| 152 |
<p class="firewall-log-report__item-value" id="wt_category"></p> |
| 153 |
</li> |
| 154 |
<li class="firewall-log-report__item"> |
| 155 |
<p class="firewall-log-report__item-title">{{ 'Country'|trans }}:</p> |
| 156 |
<p class="firewall-log-report__item-value" id="wt_country"></p> |
| 157 |
</li> |
| 158 |
</ul> |
| 159 |
<div class="firewall-log-report__payload-wrapper"> |
| 160 |
<p class="firewall-log-report__payload-title">{{ 'Payload'|trans }}:</p> |
| 161 |
<p class="firewall-log-report__payload" > |
| 162 |
<span class="firewall-log-report__payload-text" id="wt_payload"></span> |
| 163 |
<span class="wtotem-recovery-btn"> |
| 164 |
<img src="{{ images_path }}copy-min.svg" alt="" id="wtotem-request-copy"> |
| 165 |
</span> |
| 166 |
</p> |
| 167 |
</div> |
| 168 |
</section> |
| 169 |
|
| 170 |
</div> |
| 171 |
</div> |
| 172 |
</div> |
| 173 |
{% endif %} |