aiwaf 0.1.9.0.8__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 CHANGED
@@ -1,6 +1,6 @@
1
1
  default_app_config = "aiwaf.apps.AiwafConfig"
2
2
 
3
- __version__ = "0.1.9.0.8"
3
+ __version__ = "0.1.9.1.0"
4
4
 
5
5
  # Note: Middleware classes are available from aiwaf.middleware
6
6
  # Import them only when needed to avoid circular imports during Django app loading
aiwaf/storage.py CHANGED
@@ -111,6 +111,16 @@ 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
+
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
+
114
124
  @staticmethod
115
125
  def get_all_blocked_ips():
116
126
  """Get all blocked IPs"""
@@ -184,7 +194,7 @@ class ModelExemptionStore:
184
194
 
185
195
  class ModelKeywordStore:
186
196
  @staticmethod
187
- def add_keyword(keyword):
197
+ def add_keyword(keyword, count=1):
188
198
  """Add a keyword to the dynamic keyword list"""
189
199
  _import_models()
190
200
  if DynamicKeyword is None:
@@ -192,11 +202,25 @@ class ModelKeywordStore:
192
202
  try:
193
203
  obj, created = DynamicKeyword.objects.get_or_create(keyword=keyword)
194
204
  if not created:
195
- obj.count += 1
205
+ obj.count += count
206
+ obj.save()
207
+ else:
208
+ obj.count = count
196
209
  obj.save()
197
210
  except Exception as e:
198
211
  print(f"Error adding keyword {keyword}: {e}")
199
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
+
200
224
  @staticmethod
201
225
  def get_top_keywords(n=10):
202
226
  """Get top N keywords by count"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiwaf
3
- Version: 0.1.9.0.8
3
+ Version: 0.1.9.1.0
4
4
  Summary: AI-powered Web Application Firewall
5
5
  Home-page: https://github.com/aayushgauba/aiwaf
6
6
  Author: Aayush Gauba
@@ -1,11 +1,11 @@
1
- aiwaf/__init__.py,sha256=-LCCUyGlyzphKzUXm-4fajo1kuJlzIha6Qgyu-hnv-o,220
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=wyuKGkeDboz0B-RmallwGsSJ0dvt5iCDbgZqjjLkOeM,7636
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.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,,
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,,