FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ModSecurity/scripts/python/skell.py at v2/exp/python_support · CodingWord/ModSecurity · GitHub
CodingWord
ModSecurity
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
ModSecurity
/
scripts
/
python
/
skell.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
50 lines (37 loc) · 1.41 KB
Breadcrumbs
ModSecurity
/
scripts
/
python
/
skell.py
Copy path
File metadata and controls
executable file
·
50 lines (37 loc) · 1.41 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ModSecurity core binding.
from
modsecurity
import
ModSecurity
class
ModSecurityExtension
(
ModSecurity
):
"""
Class ModSecurityExtension should represents your custom module.
Nocite that this class should derivate from ModSecurity and should
implement the method process.
"""
def
__init__
(
self
):
ModSecurity
.
__init__
(
self
)
def
process
(
self
):
"""
The method is called by ModSecurity core whenever a request is
needed to be evaluated.
"""
# self.log can be utilised to produce content inside the SecDebugLog
# (https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#secdebuglog)
self
.
log
(
8
,
"This is our custom Python script, it seems that I am working"
"like a charm."
)
self
.
log
(
8
,
"Hum... Do we have something at FILES_TMPNAMES? %s"
%
self
[
"FILES_TMPNAMES"
])
# Returns True whenever you want to send a "match" to ModSecurity core.
return
True
# Should be used to test your custom extension, deattached from ModSecurity core.
if
__name__
==
"__main__"
:
myExtension
=
ModSecurityExtension
()
# Setting FILES_TMPNAMES property.
# https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#files_tmpnames
myExtension
.
FILES_TMPNAMES
=
[
"/etc/issue"
,
"/etc/resolv.conf"
]
# Process the content.
ret
=
myExtension
.
process
()
if
ret
==
True
:
print
(
"Matched!"
)
else
:
print
(
"_not_ matched"
)
Back
|
FazBrowse Home
|
New Git URL