aiwaf 0.1.9.0.7__py3-none-any.whl → 0.1.9.0.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of aiwaf might be problematic. Click here for more details.
- aiwaf/__init__.py +1 -1
- aiwaf/middleware.py +4 -4
- aiwaf/storage.py +11 -0
- {aiwaf-0.1.9.0.7.dist-info → aiwaf-0.1.9.0.8.dist-info}/METADATA +1 -1
- {aiwaf-0.1.9.0.7.dist-info → aiwaf-0.1.9.0.8.dist-info}/RECORD +8 -8
- {aiwaf-0.1.9.0.7.dist-info → aiwaf-0.1.9.0.8.dist-info}/WHEEL +0 -0
- {aiwaf-0.1.9.0.7.dist-info → aiwaf-0.1.9.0.8.dist-info}/licenses/LICENSE +0 -0
- {aiwaf-0.1.9.0.7.dist-info → aiwaf-0.1.9.0.8.dist-info}/top_level.txt +0 -0
aiwaf/__init__.py
CHANGED
aiwaf/middleware.py
CHANGED
|
@@ -135,12 +135,12 @@ class IPAndKeywordBlockMiddleware:
|
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
class RateLimitMiddleware:
|
|
138
|
-
WINDOW = 10 # seconds
|
|
139
|
-
MAX = 20 # soft limit
|
|
140
|
-
FLOOD = 40 # hard limit
|
|
141
|
-
|
|
142
138
|
def __init__(self, get_response):
|
|
143
139
|
self.get_response = get_response
|
|
140
|
+
# Make rate limiting configurable via Django settings
|
|
141
|
+
self.WINDOW = getattr(settings, "AIWAF_RATE_WINDOW", 10) # seconds
|
|
142
|
+
self.MAX = getattr(settings, "AIWAF_RATE_MAX", 20) # soft limit
|
|
143
|
+
self.FLOOD = getattr(settings, "AIWAF_RATE_FLOOD", 40) # hard limit
|
|
144
144
|
|
|
145
145
|
def __call__(self, request):
|
|
146
146
|
if is_exempt(request):
|
aiwaf/storage.py
CHANGED
|
@@ -171,6 +171,17 @@ class ModelExemptionStore:
|
|
|
171
171
|
except Exception:
|
|
172
172
|
return []
|
|
173
173
|
|
|
174
|
+
@staticmethod
|
|
175
|
+
def get_all():
|
|
176
|
+
"""Get all exempted IP entries as dictionaries"""
|
|
177
|
+
_import_models()
|
|
178
|
+
if IPExemption is None:
|
|
179
|
+
return []
|
|
180
|
+
try:
|
|
181
|
+
return list(IPExemption.objects.values('ip_address', 'reason', 'created_at'))
|
|
182
|
+
except Exception:
|
|
183
|
+
return []
|
|
184
|
+
|
|
174
185
|
class ModelKeywordStore:
|
|
175
186
|
@staticmethod
|
|
176
187
|
def add_keyword(keyword):
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
aiwaf/__init__.py,sha256
|
|
1
|
+
aiwaf/__init__.py,sha256=-LCCUyGlyzphKzUXm-4fajo1kuJlzIha6Qgyu-hnv-o,220
|
|
2
2
|
aiwaf/apps.py,sha256=nCez-Ptlv2kaEk5HenA8b1pATz1VfhrHP1344gwcY1A,142
|
|
3
3
|
aiwaf/blacklist_manager.py,sha256=LYCeKFB-7e_C6Bg2WeFJWFIIQlrfRMPuGp30ivrnhQY,1196
|
|
4
4
|
aiwaf/decorators.py,sha256=IUKOdM_gdroffImRZep1g1wT6gNqD10zGwcp28hsJCs,825
|
|
5
|
-
aiwaf/middleware.py,sha256=
|
|
5
|
+
aiwaf/middleware.py,sha256=4Ox0pUdB7rMT1Sw5XHO6-udQrfqyF9VGdkkkgLioRJ0,12470
|
|
6
6
|
aiwaf/middleware_logger.py,sha256=LWZVDAnjh6CGESirA8eMbhGgJKB7lVDGRQqVroH95Lo,4742
|
|
7
7
|
aiwaf/models.py,sha256=vQxgY19BDVMjoO903UNrTZC1pNoLltMU6wbyWPoAEns,2719
|
|
8
|
-
aiwaf/storage.py,sha256=
|
|
8
|
+
aiwaf/storage.py,sha256=wyuKGkeDboz0B-RmallwGsSJ0dvt5iCDbgZqjjLkOeM,7636
|
|
9
9
|
aiwaf/trainer.py,sha256=dOjdQ5zqEuwzffgTu7WZMokFcW5b0-KTDSjMeHBcIhw,9203
|
|
10
10
|
aiwaf/utils.py,sha256=BJk5vJCYdGPl_4QQiknjhCbkzv5HZCXgFcBJDMJpHok,3390
|
|
11
11
|
aiwaf/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -26,8 +26,8 @@ aiwaf/management/commands/test_exemption_fix.py,sha256=ngyGaHUCmQQ6y--6j4q1viZJt
|
|
|
26
26
|
aiwaf/resources/model.pkl,sha256=5t6h9BX8yoh2xct85MXOO60jdlWyg1APskUOW0jZE1Y,1288265
|
|
27
27
|
aiwaf/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
aiwaf/templatetags/aiwaf_tags.py,sha256=XXfb7Tl4DjU3Sc40GbqdaqOEtKTUKELBEk58u83wBNw,357
|
|
29
|
-
aiwaf-0.1.9.0.
|
|
30
|
-
aiwaf-0.1.9.0.
|
|
31
|
-
aiwaf-0.1.9.0.
|
|
32
|
-
aiwaf-0.1.9.0.
|
|
33
|
-
aiwaf-0.1.9.0.
|
|
29
|
+
aiwaf-0.1.9.0.8.dist-info/licenses/LICENSE,sha256=Ir8PX4dxgAcdB0wqNPIkw84fzIIRKE75NoUil9RX0QU,1069
|
|
30
|
+
aiwaf-0.1.9.0.8.dist-info/METADATA,sha256=TT5yqQmRImV29TovjH3FUkWyfXoyPFyia2Rqz4qYni8,13763
|
|
31
|
+
aiwaf-0.1.9.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
32
|
+
aiwaf-0.1.9.0.8.dist-info/top_level.txt,sha256=kU6EyjobT6UPCxuWpI_BvcHDG0I2tMgKaPlWzVxe2xI,6
|
|
33
|
+
aiwaf-0.1.9.0.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|