Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CnChunfeng
/
ichunt_lua_waf
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6367c22d
authored
Oct 19, 2020
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改代码
parent
a4bc142a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
waf.lua
wafcheck.lua
waf.lua
View file @
6367c22d
...
@@ -408,6 +408,11 @@ red:lpush('spider_ip_info_list',cjson.encode(arr))
...
@@ -408,6 +408,11 @@ red:lpush('spider_ip_info_list',cjson.encode(arr))
res
,
err
=
red
:
expire
(
spider_time
..
user_ip
,
spider_key_exit_time
)
res
,
err
=
red
:
expire
(
spider_time
..
user_ip
,
spider_key_exit_time
)
res
,
err
=
red
:
expire
(
spider_count
..
user_ip
,
spider_key_exit_time
)
res
,
err
=
red
:
expire
(
spider_count
..
user_ip
,
spider_key_exit_time
)
local
ok
,
err
=
red
:
close
()
ngx
.
say
(
ok
)
ngx
.
say
(
err
)
ngx
.
exit
(
ngx
.
HTTP_FORBIDDEN
)
...
...
wafcheck.lua
View file @
6367c22d
...
@@ -8,7 +8,7 @@ local _Wafcheck= {}
...
@@ -8,7 +8,7 @@ local _Wafcheck= {}
--------白名单ip-----------
--------白名单ip-----------
function
_Wafcheck
.
WhiteIp
(
user_ip
)
function
_Wafcheck
.
WhiteIp
(
user_ip
)
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_white_ip'
,
user_ip
)
local
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_white_ip'
,
user_ip
)
if
is_exist
==
1
then
if
is_exist
==
1
then
return
"exist"
return
"exist"
end
end
...
@@ -18,7 +18,7 @@ end
...
@@ -18,7 +18,7 @@ end
--------白名单url-----------
--------白名单url-----------
function
_Wafcheck
.
WhiteUrl
(
url
)
function
_Wafcheck
.
WhiteUrl
(
url
)
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_white_url'
,
url
)
local
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_white_url'
,
url
)
if
is_exist
==
1
then
if
is_exist
==
1
then
return
"exist"
return
"exist"
end
end
...
@@ -28,7 +28,7 @@ end
...
@@ -28,7 +28,7 @@ end
--------白名单header-----------
--------白名单header-----------
function
_Wafcheck
.
WhiteHeader
(
header
)
function
_Wafcheck
.
WhiteHeader
(
header
)
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_white_header'
,
header
)
local
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_white_header'
,
header
)
if
is_exist
==
1
then
if
is_exist
==
1
then
return
"exist"
return
"exist"
end
end
...
@@ -39,7 +39,7 @@ end
...
@@ -39,7 +39,7 @@ end
-------黑名单Ip
-------黑名单Ip
function
_Wafcheck
.
BlackIp
(
user_ip
)
function
_Wafcheck
.
BlackIp
(
user_ip
)
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_black_ip'
,
user_ip
)
local
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_black_ip'
,
user_ip
)
if
is_exist
==
1
then
if
is_exist
==
1
then
return
"exist"
return
"exist"
end
end
...
@@ -49,7 +49,7 @@ end
...
@@ -49,7 +49,7 @@ end
-------黑名单Url
-------黑名单Url
function
_Wafcheck
.
BlackUrl
(
url
)
function
_Wafcheck
.
BlackUrl
(
url
)
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_black_url'
,
url
)
local
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_black_url'
,
url
)
if
is_exist
==
1
then
if
is_exist
==
1
then
return
"exist"
return
"exist"
end
end
...
@@ -59,7 +59,7 @@ end
...
@@ -59,7 +59,7 @@ end
-------黑名单header
-------黑名单header
function
_Wafcheck
.
BlackHeader
(
header
)
function
_Wafcheck
.
BlackHeader
(
header
)
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_black_header'
,
header
)
local
is_exist
,
err
=
red
:
sismember
(
'ichunt_waf_black_header'
,
header
)
if
is_exist
==
1
then
if
is_exist
==
1
then
return
"exist"
return
"exist"
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment