aiwaf 0.1.9.0.9__py3-none-any.whl → 0.1.9.1.0__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/storage.py +21 -2
- {aiwaf-0.1.9.0.9.dist-info → aiwaf-0.1.9.1.0.dist-info}/METADATA +1 -1
- {aiwaf-0.1.9.0.9.dist-info → aiwaf-0.1.9.1.0.dist-info}/RECORD +7 -7
- {aiwaf-0.1.9.0.9.dist-info → aiwaf-0.1.9.1.0.dist-info}/WHEEL +0 -0
- {aiwaf-0.1.9.0.9.dist-info → aiwaf-0.1.9.1.0.dist-info}/licenses/LICENSE +0 -0
- {aiwaf-0.1.9.0.9.dist-info → aiwaf-0.1.9.1.0.dist-info}/top_level.txt +0 -0
aiwaf/__init__.py
CHANGED
aiwaf/storage.py
CHANGED
|
@@ -116,6 +116,11 @@ class ModelBlacklistStore:
|
|
|
116
116
|
"""Remove IP from blacklist (alias for unblock_ip)"""
|
|
117
117
|
ModelBlacklistStore.unblock_ip(ip)
|
|
118
118
|
|
|
119
|
+
@staticmethod
|
|
120
|
+
def add_ip(ip, reason="Automated block"):
|
|
121
|
+
"""Add IP to blacklist (alias for block_ip)"""
|
|
122
|
+
ModelBlacklistStore.block_ip(ip, reason)
|
|
123
|
+
|
|
119
124
|
@staticmethod
|
|
120
125
|
def get_all_blocked_ips():
|
|
121
126
|
"""Get all blocked IPs"""
|
|
@@ -189,7 +194,7 @@ class ModelExemptionStore:
|
|
|
189
194
|
|
|
190
195
|
class ModelKeywordStore:
|
|
191
196
|
@staticmethod
|
|
192
|
-
def add_keyword(keyword):
|
|
197
|
+
def add_keyword(keyword, count=1):
|
|
193
198
|
"""Add a keyword to the dynamic keyword list"""
|
|
194
199
|
_import_models()
|
|
195
200
|
if DynamicKeyword is None:
|
|
@@ -197,11 +202,25 @@ class ModelKeywordStore:
|
|
|
197
202
|
try:
|
|
198
203
|
obj, created = DynamicKeyword.objects.get_or_create(keyword=keyword)
|
|
199
204
|
if not created:
|
|
200
|
-
obj.count +=
|
|
205
|
+
obj.count += count
|
|
206
|
+
obj.save()
|
|
207
|
+
else:
|
|
208
|
+
obj.count = count
|
|
201
209
|
obj.save()
|
|
202
210
|
except Exception as e:
|
|
203
211
|
print(f"Error adding keyword {keyword}: {e}")
|
|
204
212
|
|
|
213
|
+
@staticmethod
|
|
214
|
+
def remove_keyword(keyword):
|
|
215
|
+
"""Remove a keyword from the dynamic keyword list"""
|
|
216
|
+
_import_models()
|
|
217
|
+
if DynamicKeyword is None:
|
|
218
|
+
return
|
|
219
|
+
try:
|
|
220
|
+
DynamicKeyword.objects.filter(keyword=keyword).delete()
|
|
221
|
+
except Exception as e:
|
|
222
|
+
print(f"Error removing keyword {keyword}: {e}")
|
|
223
|
+
|
|
205
224
|
@staticmethod
|
|
206
225
|
def get_top_keywords(n=10):
|
|
207
226
|
"""Get top N keywords by count"""
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
aiwaf/__init__.py,sha256=
|
|
1
|
+
aiwaf/__init__.py,sha256=w6y-K1NWTiNI6RU3sCkHiVQQxj4ypLIWTpD1CpqYWSQ,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
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=HYSnis7S8ETsos_NxWkd05OoiHXMhIWQy8FcFTqO4vk,8408
|
|
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.1.0.dist-info/licenses/LICENSE,sha256=Ir8PX4dxgAcdB0wqNPIkw84fzIIRKE75NoUil9RX0QU,1069
|
|
30
|
+
aiwaf-0.1.9.1.0.dist-info/METADATA,sha256=sacvG0c1v208_gFu1xqUeYpnp1AvzLzviLjAcVYcL4o,13763
|
|
31
|
+
aiwaf-0.1.9.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
32
|
+
aiwaf-0.1.9.1.0.dist-info/top_level.txt,sha256=kU6EyjobT6UPCxuWpI_BvcHDG0I2tMgKaPlWzVxe2xI,6
|
|
33
|
+
aiwaf-0.1.9.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|