From 84f2c20f2ab238242c1e87cf462193bd44bf8233 Mon Sep 17 00:00:00 2001 From: midoks Date: Fri, 11 Nov 2022 02:38:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E4=BD=93=E5=AD=97=E7=AC=A6=E7=BC=96?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/op_waf/js/op_waf.js | 6 ++---- route/static/app/public.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/plugins/op_waf/js/op_waf.js b/plugins/op_waf/js/op_waf.js index 87a853560..170c7a871 100755 --- a/plugins/op_waf/js/op_waf.js +++ b/plugins/op_waf/js/op_waf.js @@ -1612,8 +1612,6 @@ function wafSite(){ }); } - - function wafLogRequest(page){ var args = {}; args['page'] = page; @@ -1640,9 +1638,9 @@ function wafLogRequest(page){ list += '' + getLocalTime(data[i]['time'])+''; list += '' + data[i]['domain'] +''; list += '' + data[i]['ip'] +''; - list += '' + data[i]['uri'] +''; + list += '' + data[i]['uri'] +'';// data[i]['uri'] list += '' + data[i]['rule_name'] +''; - list += '' + data[i]['reason'] +''; + list += '' + entitiesEncode(data[i]['reason']) +'';//data[i]['reason'] list += '详情'; list += ''; } diff --git a/route/static/app/public.js b/route/static/app/public.js index 23ca5ae39..18238915d 100755 --- a/route/static/app/public.js +++ b/route/static/app/public.js @@ -1620,6 +1620,34 @@ function toArrayObject(str){ return data; } +/** +* 实体字符编码 +* @param {*} text 待编码的文本 +* @returns +*/ +function entitiesEncode(text) { + text = text.replace(/&/g, "&"); + text = text.replace(//g, ">"); + text = text.replace(/ /g, " "); + text = text.replace(/"/g, """); + return text; +} +/** +* 实体字符解码 +* @param {*} text 待解码的文本 +* @returns +*/ +function entitiesDecode(text) { + text = text.replace(/&/g, "&"); + text = text.replace(/</g, "<"); + text = text.replace(/>/g, ">"); + text = text.replace(/ /g, " "); + text = text.replace(/"/g, "'"); + return text; +} + + function pluginService(_name, version){ var data = {name:_name, func:'status'} if ( typeof(version) != 'undefined' ){