diff --git a/plugins/op_waf/index.py b/plugins/op_waf/index.py index e3ef7135e..30d4f2fb3 100755 --- a/plugins/op_waf/index.py +++ b/plugins/op_waf/index.py @@ -639,8 +639,35 @@ def setRetry(): def setSiteRetry(): + return public.returnJson(True, '设置成功-?!', []) + + +def setCcConf(): + args = getArgs() + data = checkArgs(args, ['siteName', 'cycle', 'limit', 'endtime','is_open_global','increase']) + if not data[0]: + return data[1] + + conf = getJsonPath('config') + content = public.readFile(conf) + cobj = json.loads(content) + + tmp = cobj['cc'] + + + tmp['cycle'] = args['cycle'] + tmp['limit'] = args['limit'] + tmp['endtime'] = args['endtime'] + tmp['is_open_global'] = args['is_open_global'] + tmp['increase'] = args['increase'] + cobj['cc'] = tmp + + cjson = public.getJson(cobj) + public.writeFile(conf, cjson) return public.returnJson(True, '设置成功!', []) +def setSiteCcConf(): + return public.returnJson(True, '设置成功-?!', []) def saveScanRule(): args = getArgs() @@ -861,6 +888,7 @@ def setSiteObjOpen(): return public.returnJson(True, '设置成功!') + def getWafSrceen(): conf = getJsonPath('total') return public.readFile(conf) @@ -923,6 +951,10 @@ if __name__ == "__main__": print setObjOpen() elif func == 'set_site_obj_open': print setSiteObjOpen() + elif func == 'set_cc_conf': + print setCcConf() + elif func == 'set_site_cc_conf': + print setSiteCcConf() elif func == 'set_retry': print setRetry() elif func == 'set_site_retry': diff --git a/plugins/op_waf/js/op_waf.js b/plugins/op_waf/js/op_waf.js index 3b9bbdb30..38f76aa4b 100755 --- a/plugins/op_waf/js/op_waf.js +++ b/plugins/op_waf/js/op_waf.js @@ -77,101 +77,104 @@ function setObjOpen(ruleName){ }); } + +//保存CC规则 +function saveCcRule(siteName,is_open_global, type) { + var increase = "0"; + if(type == 2){ + // set_aicc_open('start'); + increase = "0"; + }else{ + // set_aicc_open('stop'); + increase = type; + } + increase = "0"; + var pdata = { + siteName:siteName, + cycle: $("input[name='cc_cycle']").val(), + limit: $("input[name='cc_limit']").val(), + endtime: $("input[name='cc_endtime']").val(), + is_open_global:is_open_global, + increase:increase + } + console.log(pdata); + var act = 'set_cc_conf'; + if (siteName != 'undefined') act = 'set_site_cc_conf'; + + owPost(act, pdata, function(data){ + var rdata = $.parseJSON(data.data); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + setTimeout(function(){ + if (siteName != 'undefined') { + siteWafConfig(siteName, 1); + } else { + wafGloabl(); + } + },1000); + }); +} + + function setCcRule(cycle, limit, endtime, siteName, increase){ var incstr = '