pull/209/head
midoks 3 years ago
parent 8b70637479
commit dcdb07f76d
  1. 1
      plugins/op_waf/index.py
  2. 17
      plugins/op_waf/t/index.py
  3. 83
      plugins/op_waf/waf/lua/init.lua
  4. 2
      plugins/op_waf/waf/total.json

@ -178,6 +178,7 @@ def initTotalInfo():
tmp['get'] = 0 tmp['get'] = 0
tmp['post'] = 0 tmp['post'] = 0
tmp['total'] = 0 tmp['total'] = 0
tmp['url_ext'] = 0
_name = {} _name = {}
_name[name] = tmp _name[name] = tmp
total_contents['sites'] = _name total_contents['sites'] = _name

@ -145,15 +145,26 @@ def test_CC():
print("CC test end") print("CC test end")
# 7FKnElusaEqY0qIc
def test_url_ext():
'''
目录保存
'''
url = TEST_URL + 't.sql'
print("url_ext start")
url_val = httpGet(url, 10)
print(url_val)
print("url_ext end")
def test_start(): def test_start():
test_Dir() # test_Dir()
test_UA() # test_UA()
# test_POST() # test_POST()
# test_scan() # test_scan()
# test_CC() # test_CC()
test_url_ext()
if __name__ == "__main__": if __name__ == "__main__":

@ -43,6 +43,10 @@ C:setParams(params)
C:setDebug(true) C:setDebug(true)
local server_name = params["server_name"]
C:D(server_name)
function get_return_state(rstate,rmsg) function get_return_state(rstate,rmsg)
result = {} result = {}
result['status'] = rstate result['status'] = rstate
@ -412,39 +416,39 @@ function post_X_Forwarded()
end end
function php_path() -- function php_path()
if site_config[server_name] == nil then return false end -- if site_config[server_name] == nil then return false end
for _,rule in ipairs(site_config[server_name]['disable_php_path']) -- for _,rule in ipairs(site_config[server_name]['disable_php_path'])
do -- do
if ngx_match(uri,rule .. "/?.*\\.php$","isjo") then -- if C:ngx_match_string(params['uri'],rule .. "/?.*\\.php$","isjo") then
C:write_log('php_path','regular') -- C:write_log('php_path','regular')
C:return_html(config['other']['status'],other_html) -- C:return_html(config['other']['status'],other_html)
return C:return_message(200,uri) -- return C:return_message(200,uri)
end -- end
end -- end
return false -- return false
end -- end
function url_path() -- function url_path()
if site_config[server_name] == nil then return false end -- if site_config[server_name] == nil then return false end
for _,rule in ipairs(site_config[server_name]['disable_path']) -- for _,rule in ipairs(site_config[server_name]['disable_path'])
do -- do
if ngx_match(uri,rule,"isjo") then -- if ngx_match(uri,rule,"isjo") then
C:write_log('path','regular') -- C:write_log('path','regular')
C:return_html(config['other']['status'],other_html) -- C:return_html(config['other']['status'],other_html)
return true -- return true
end -- end
end -- end
return false -- return false
end -- end
function url_ext() function url_ext()
if site_config[server_name] == nil then return false end if site_config[server_name] == nil then return false end
for _,rule in ipairs(site_config[server_name]['disable_ext']) for _,rule in ipairs(site_config[server_name]['disable_ext'])
do do
if ngx_match(uri,"\\."..rule.."$","isjo") then if C:ngx_match_string("\\."..rule.."$", params['uri'],'url_ext') then
C:write_log('url_ext','regular') C:write_log('url_ext','regular')
C:return_html(config['other']['status'],other_html) C:return_html(config['other']['status'], other_html)
return true return true
end end
end end
@ -571,7 +575,6 @@ function waf()
if waf_ip_black() then return true end if waf_ip_black() then return true end
-- cc setting -- cc setting
if waf_drop() then return true end if waf_drop() then return true end
if waf_cc() then return true end if waf_cc() then return true end
@ -581,26 +584,24 @@ function waf()
if waf_url() then return true end if waf_url() then return true end
-- cookie检查 -- cookie检查
waf_cookie() if waf_cookie() then return true end
-- args参数拦截 -- args参数拦截
waf_get_args() if waf_get_args() then return true end
-- 扫描软件禁止 -- 扫描软件禁止
waf_scan_black() if waf_scan_black() then return true end
waf_post() if waf_post() then return true end
post_data_chekc() if post_data_chekc() then return true end
local server_name = params["server_name"]
if site_config[server_name] then if site_config[server_name] then
X_Forwarded() if X_Forwarded() then return true end
post_X_Forwarded() if post_X_Forwarded() then return true end
php_path() -- url_path()
url_path() if url_ext() then return true end
url_ext() -- url_rule_ex()
url_rule_ex() -- url_tell()
url_tell()
post_data() post_data()
end end
end end

@ -1 +1 @@
{"rules":{"user_agent":0,"scan":0,"cookie":0,"post":0,"args":0,"url":0,"cc":0},"sites":{},"total":0} {"rules":{"url_ext":0,"user_agent":0,"scan":0,"cookie":0,"post":0,"args":0,"url":0,"cc":0},"sites":{},"total":0}
Loading…
Cancel
Save