diff --git a/plugins/op_waf/index.py b/plugins/op_waf/index.py
index 49c16ecf5..d9808314a 100755
--- a/plugins/op_waf/index.py
+++ b/plugins/op_waf/index.py
@@ -192,7 +192,24 @@ def setObjStatus():
return public.returnJson(True, '设置成功!')
def setRetry():
- pass
+ args = getArgs()
+ data = checkArgs(args, ['retry', 'retry_time','retry_cycle','is_open_global'])
+ if not data[0]:
+ return data[1]
+
+ conf = getJsonPath('config')
+ content = public.readFile(conf)
+ cobj = json.loads(content)
+
+ cobj['retry'] = args
+
+ cjson = public.getJson(cobj)
+ public.writeFile(conf, cjson)
+
+ return public.returnJson(True, '设置成功!', [])
+
+def setSiteRetry():
+ return public.returnJson(True, '设置成功!', [])
def setObjOpen():
@@ -252,6 +269,8 @@ if __name__ == "__main__":
print setObjOpen()
elif func == 'set_retry':
print setRetry()
+ elif func == 'set_site_retry':
+ print setSiteRetry()
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 1903fa33c..ec90a15f4 100755
--- a/plugins/op_waf/js/op_waf.js
+++ b/plugins/op_waf/js/op_waf.js
@@ -18,7 +18,7 @@ function owPost(method, args, callback){
function getRuleByName(rule_name, callback){
owPost('get_rule', {rule_name:rule_name}, function(data){
callback(data);
- })
+ });
}
@@ -177,7 +177,7 @@ function setCcRule(cycle, limit, endtime, siteName, increase){
//设置retry规则
function setRetry(retry_cycle, retry, retry_time, siteName) {
- layer.open({
+ create_layer = layer.open({
type: 1,
title: "设置恶意容忍规则",
area: '500px',
@@ -226,23 +226,15 @@ function saveRetry(siteName,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();
- }
- }
+ owPost(act, pdata, function(data){
+ var rdata = $.parseJSON(data.data);
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
+ layer.close(create_layer);
+ wafGloablRefresh(1000);
});
}
-
//URL白名单
function urlWhite(type) {
if (type == undefined) {
@@ -388,11 +380,14 @@ function setObjConf(ruleName, type) {
\
常见扫描器 | '+ rdata.scan.ps + ' | ' + rdata.scan.status + ' | \
diff --git a/plugins/op_waf/waf/config.json b/plugins/op_waf/waf/config.json
index 18fe55e95..8ef61762c 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", "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": {"retry_time": "180", "is_open_global": "0", "retry": "6", "retry_cycle": "60"}, "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
|