From cf126d5d2482bc103f1022a47d23f03ce91f08df Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 29 Apr 2019 10:29:52 +0800 Subject: [PATCH] update --- plugins/op_waf/index.py | 5 +++++ plugins/op_waf/js/op_waf.js | 35 +++++++++++++++++++++++++++++++--- plugins/op_waf/waf/config.json | 2 +- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/plugins/op_waf/index.py b/plugins/op_waf/index.py index d022f23ba..49c16ecf5 100755 --- a/plugins/op_waf/index.py +++ b/plugins/op_waf/index.py @@ -191,6 +191,9 @@ def setObjStatus(): public.writeFile(conf, cjson) return public.returnJson(True, '设置成功!') +def setRetry(): + pass + def setObjOpen(): args = getArgs() @@ -247,6 +250,8 @@ if __name__ == "__main__": print setObjStatus() elif func == 'set_obj_open': print setObjOpen() + elif func == 'set_retry': + print setRetry() elif func == 'waf_srceen': print getWafSrceen() elif func == 'waf_conf': diff --git a/plugins/op_waf/js/op_waf.js b/plugins/op_waf/js/op_waf.js index eeb92ad58..1903fa33c 100755 --- a/plugins/op_waf/js/op_waf.js +++ b/plugins/op_waf/js/op_waf.js @@ -177,7 +177,7 @@ function setCcRule(cycle, limit, endtime, siteName, increase){ //设置retry规则 function setRetry(retry_cycle, retry, retry_time, siteName) { - create_l = layer.open({ + layer.open({ type: 1, title: "设置恶意容忍规则", area: '500px', @@ -204,16 +204,45 @@ function setRetry(retry_cycle, retry, retry_time, siteName) { ', success:function(){ $('.btn_retry_all').click(function(){ - save_retry(siteName,1); + saveRetry(siteName,1); }); $('.btn_retry_present').click(function(){ - save_retry(siteName,0); + saveRetry(siteName,0); }); } }); } +//保存retry规则 +function saveRetry(siteName,type) { + var pdata = { + siteName: siteName, + retry: $("input[name='retry']").val(), + retry_time: $("input[name='retry_time']").val(), + retry_cycle: $("input[name='retry_cycle']").val(), + is_open_global:type + } + + var act = 'set_retry'; + if (siteName != undefined) act = 'set_site_retry'; + var loadT = layer.msg('正在保存,请稍候..', { icon: 16, time: 0 }); + $.post('/plugin?action=a&name=btwaf&s=' + act, pdata, function (rdata) { + layer.close(loadT); + if (rdata.status) { + layer.close(create_l); + if (siteName != 'undefined') { + site_waf_config(siteName, 1); + } else { + wafconfig(); + } + } + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + }); +} + + + //URL白名单 function urlWhite(type) { if (type == undefined) { diff --git a/plugins/op_waf/waf/config.json b/plugins/op_waf/waf/config.json index aae507cca..18fe55e95 100755 --- a/plugins/op_waf/waf/config.json +++ b/plugins/op_waf/waf/config.json @@ -1 +1 @@ -{"reqfile_path": "/Users/midoks/Desktop/fwww/server/openresty/nginx/conf/waf/html", "drop_abroad": {"status": 444, "ps": "\u7981\u6b62\u4e2d\u56fd\u5927\u9646\u4ee5\u5916\u7684\u5730\u533a\u8bbf\u95ee\u7ad9\u70b9", "open": true, "reqfile": ""}, "retry": 6, "log": true, "retry_cycle": 60, "scan": {"status": 444, "ps": "\u8fc7\u6ee4\u5e38\u89c1\u626b\u63cf\u6d4b\u8bd5\u5de5\u5177\u7684\u6e17\u900f\u6d4b\u8bd5", "open": true, "reqfile": ""}, "cc": {"status": 444, "ps": "\u8fc7\u8651CC\u653b\u51fb", "limit": 120, "endtime": 300, "open": true, "reqfile": "", "cycle": 60}, "body_character_string": [], "start_time": 1556095983.425878, "get": {"status": 403, "ps": "\u8fc7\u6ee4uri\u3001uri\u53c2\u6570\u4e2d\u5e38\u89c1sql\u6ce8\u5165\u3001xss\u7b49\u653b\u51fb", "open": true, "reqfile": "get.html"}, "body_regular": [], "log_save": 30, "user-agent": {"status": 403, "ps": "\u901a\u5e38\u7528\u4e8e\u8fc7\u6ee4\u6d4f\u89c8\u5668\u3001\u8718\u86db\u53ca\u4e00\u4e9b\u81ea\u52a8\u626b\u63cf\u5668", "open": true, "reqfile": "user_agent.html"}, "logs_path": "/www/wwwlogs/btwaf", "other": {"status": 403, "ps": "\u5176\u5b83\u975e\u901a\u7528\u8fc7\u6ee4", "reqfile": "other.html"}, "cookie": {"status": 403, "ps": "\u8fc7\u6ee4\u5229\u7528Cookie\u53d1\u8d77\u7684\u6e17\u900f\u653b\u51fb", "open": true, "reqfile": "cookie.html"}, "retry_time": 180, "post": {"status": 403, "ps": "\u8fc7\u6ee4POST\u53c2\u6570\u4e2d\u5e38\u89c1sql\u6ce8\u5165\u3001xss\u7b49\u653b\u51fb", "open": true, "reqfile": "post.html"}, "open": true} \ No newline at end of file +{"reqfile_path": "/Users/midoks/Desktop/fwww/server/openresty/nginx/conf/waf/html", "retry": 6, "log": true, "retry_cycle": 60, "scan": {"status": 444, "ps": "\u8fc7\u6ee4\u5e38\u89c1\u626b\u63cf\u6d4b\u8bd5\u5de5\u5177\u7684\u6e17\u900f\u6d4b\u8bd5", "open": true, "reqfile": ""}, "cc": {"status": 444, "ps": "\u8fc7\u8651CC\u653b\u51fb", "limit": 120, "endtime": 300, "open": true, "reqfile": "", "cycle": 60}, "body_character_string": [], "start_time": 1556095983.425878, "get": {"status": 403, "ps": "\u8fc7\u6ee4uri\u3001uri\u53c2\u6570\u4e2d\u5e38\u89c1sql\u6ce8\u5165\u3001xss\u7b49\u653b\u51fb", "open": true, "reqfile": "get.html"}, "body_regular": [], "log_save": 30, "user-agent": {"status": 403, "ps": "\u901a\u5e38\u7528\u4e8e\u8fc7\u6ee4\u6d4f\u89c8\u5668\u3001\u8718\u86db\u53ca\u4e00\u4e9b\u81ea\u52a8\u626b\u63cf\u5668", "open": true, "reqfile": "user_agent.html"}, "logs_path": "/www/wwwlogs/btwaf", "other": {"status": 403, "ps": "\u5176\u5b83\u975e\u901a\u7528\u8fc7\u6ee4", "reqfile": "other.html"}, "cookie": {"status": 403, "ps": "\u8fc7\u6ee4\u5229\u7528Cookie\u53d1\u8d77\u7684\u6e17\u900f\u653b\u51fb", "open": true, "reqfile": "cookie.html"}, "retry_time": 180, "post": {"status": 403, "ps": "\u8fc7\u6ee4POST\u53c2\u6570\u4e2d\u5e38\u89c1sql\u6ce8\u5165\u3001xss\u7b49\u653b\u51fb", "open": true, "reqfile": "post.html"}, "open": true} \ No newline at end of file