aiwaf 0.1.9.0.7__py3-none-any.whl → 0.1.9.0.9__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 +16 -0
- {aiwaf-0.1.9.0.7.dist-info → aiwaf-0.1.9.0.9.dist-info}/METADATA +1 -1
- {aiwaf-0.1.9.0.7.dist-info → aiwaf-0.1.9.0.9.dist-info}/RECORD +8 -8
- {aiwaf-0.1.9.0.7.dist-info → aiwaf-0.1.9.0.9.dist-info}/WHEEL +0 -0
- {aiwaf-0.1.9.0.7.dist-info → aiwaf-0.1.9.0.9.dist-info}/licenses/LICENSE +0 -0
- {aiwaf-0.1.9.0.7.dist-info → aiwaf-0.1.9.0.9.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
|
@@ -111,6 +111,11 @@ class ModelBlacklistStore:
|
|
|
111
111
|
except Exception as e:
|
|
112
112
|
print(f"Error unblocking IP {ip}: {e}")
|
|
113
113
|
|
|
114
|
+
@staticmethod
|
|
115
|
+
def remove_ip(ip):
|
|
116
|
+
"""Remove IP from blacklist (alias for unblock_ip)"""
|
|
117
|
+
ModelBlacklistStore.unblock_ip(ip)
|
|
118
|
+
|
|
114
119
|
@staticmethod
|
|
115
120
|
def get_all_blocked_ips():
|
|
116
121
|
"""Get all blocked IPs"""
|
|
@@ -171,6 +176,17 @@ class ModelExemptionStore:
|
|
|
171
176
|
except Exception:
|
|
172
177
|
return []
|
|
173
178
|
|
|
179
|
+
@staticmethod
|
|
180
|
+
def get_all():
|
|
181
|
+
"""Get all exempted IP entries as dictionaries"""
|
|
182
|
+
_import_models()
|
|
183
|
+
if IPExemption is None:
|
|
184
|
+
return []
|
|
185
|
+
try:
|
|
186
|
+
return list(IPExemption.objects.values('ip_address', 'reason', 'created_at'))
|
|
187
|
+
except Exception:
|
|
188
|
+
return []
|
|
189
|
+
|
|
174
190
|
class ModelKeywordStore:
|
|
175
191
|
@staticmethod
|
|
176
192
|
def add_keyword(keyword):
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
aiwaf/__init__.py,sha256=
|
|
1
|
+
aiwaf/__init__.py,sha256=06AIH-8CTV0EiCTYU4yai9x4cfBcJ12BONhmB9MJ25s,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=M_MT0z7rwqAxRTfxlFUxESVJiq6-x9tHw0JSX-EOOo0,7783
|
|
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.9.dist-info/licenses/LICENSE,sha256=Ir8PX4dxgAcdB0wqNPIkw84fzIIRKE75NoUil9RX0QU,1069
|
|
30
|
+
aiwaf-0.1.9.0.9.dist-info/METADATA,sha256=Ee1HG67zz35gFuvRfctd76FLm3eEdccUuZxAw9BJlnU,13763
|
|
31
|
+
aiwaf-0.1.9.0.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
32
|
+
aiwaf-0.1.9.0.9.dist-info/top_level.txt,sha256=kU6EyjobT6UPCxuWpI_BvcHDG0I2tMgKaPlWzVxe2xI,6
|
|
33
|
+
aiwaf-0.1.9.0.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|