aiwaf 0.1.9.0.5__py3-none-any.whl → 0.1.9.0.7__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/blacklist_manager.py +3 -3
- aiwaf/management/commands/add_exemption.py +30 -0
- aiwaf/management/commands/add_ipexemption.py +1 -1
- aiwaf/management/commands/clear_cache.py +18 -0
- aiwaf/management/commands/debug_csv.py +1 -1
- aiwaf/management/commands/diagnose_blocking.py +96 -0
- aiwaf/management/commands/setup_models.py +35 -0
- aiwaf/management/commands/test_exemption.py +1 -1
- aiwaf/middleware_logger.py +66 -106
- aiwaf/models.py +28 -1
- aiwaf/storage.py +166 -381
- aiwaf/trainer.py +0 -12
- {aiwaf-0.1.9.0.5.dist-info → aiwaf-0.1.9.0.7.dist-info}/METADATA +30 -27
- aiwaf-0.1.9.0.7.dist-info/RECORD +33 -0
- aiwaf-0.1.9.0.5.dist-info/RECORD +0 -29
- {aiwaf-0.1.9.0.5.dist-info → aiwaf-0.1.9.0.7.dist-info}/WHEEL +0 -0
- {aiwaf-0.1.9.0.5.dist-info → aiwaf-0.1.9.0.7.dist-info}/licenses/LICENSE +0 -0
- {aiwaf-0.1.9.0.5.dist-info → aiwaf-0.1.9.0.7.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aiwaf
|
|
3
|
-
Version: 0.1.9.0.
|
|
3
|
+
Version: 0.1.9.0.7
|
|
4
4
|
Summary: AI-powered Web Application Firewall
|
|
5
5
|
Home-page: https://github.com/aayushgauba/aiwaf
|
|
6
6
|
Author: Aayush Gauba
|
|
@@ -68,7 +68,7 @@ aiwaf/
|
|
|
68
68
|
## 🚀 Features
|
|
69
69
|
|
|
70
70
|
- **IP Blocklist**
|
|
71
|
-
Instantly blocks suspicious IPs
|
|
71
|
+
Instantly blocks suspicious IPs using Django models with real-time performance.
|
|
72
72
|
|
|
73
73
|
- **Rate Limiting**
|
|
74
74
|
Sliding‑window blocks flooders (> `AIWAF_RATE_MAX` per `AIWAF_RATE_WINDOW`), then blacklists them.
|
|
@@ -98,9 +98,9 @@ aiwaf/
|
|
|
98
98
|
Blocks guessed or invalid UUIDs that don't resolve to real models.
|
|
99
99
|
|
|
100
100
|
- **Built-in Request Logger**
|
|
101
|
-
Optional middleware logger that captures requests to
|
|
101
|
+
Optional middleware logger that captures requests to Django models:
|
|
102
102
|
- **Automatic fallback** when main access logs unavailable
|
|
103
|
-
- **
|
|
103
|
+
- **Real-time storage** in database for instant access
|
|
104
104
|
- **Captures response times** for better anomaly detection
|
|
105
105
|
- **Zero configuration** - works out of the box
|
|
106
106
|
|
|
@@ -221,28 +221,33 @@ AIWAF_ACCESS_LOG = "/var/log/nginx/access.log"
|
|
|
221
221
|
|
|
222
222
|
---
|
|
223
223
|
|
|
224
|
-
###
|
|
224
|
+
### Database Models
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
AI-WAF uses Django models for real-time, high-performance storage:
|
|
227
227
|
|
|
228
228
|
```python
|
|
229
|
-
#
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
#
|
|
233
|
-
|
|
234
|
-
|
|
229
|
+
# All data is stored in Django models - no configuration needed
|
|
230
|
+
# Tables created automatically with migrations:
|
|
231
|
+
# - aiwaf_blacklistentry # Blocked IP addresses
|
|
232
|
+
# - aiwaf_ipexemption # Exempt IP addresses
|
|
233
|
+
# - aiwaf_dynamickeyword # Dynamic keywords with counts
|
|
234
|
+
# - aiwaf_featuresample # Feature samples for ML training
|
|
235
|
+
# - aiwaf_requestlog # Request logs (if middleware logging enabled)
|
|
235
236
|
```
|
|
236
237
|
|
|
237
|
-
**
|
|
238
|
-
- No
|
|
239
|
-
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
238
|
+
**Benefits of Django Models:**
|
|
239
|
+
- ⚡ **Real-time performance** - No file I/O bottlenecks
|
|
240
|
+
- 🔄 **Instant updates** - Changes visible immediately across all processes
|
|
241
|
+
- 🚀 **Better concurrency** - No file locking issues
|
|
242
|
+
- 📊 **Rich querying** - Use Django ORM for complex operations
|
|
243
|
+
- 🔍 **Admin integration** - View/manage data through Django admin
|
|
244
|
+
|
|
245
|
+
**Database Setup:**
|
|
246
|
+
```bash
|
|
247
|
+
# Create and apply migrations
|
|
248
|
+
python manage.py makemigrations aiwaf
|
|
249
|
+
python manage.py migrate aiwaf
|
|
250
|
+
```
|
|
246
251
|
|
|
247
252
|
---
|
|
248
253
|
|
|
@@ -253,8 +258,6 @@ Enable AI-WAF's built-in request logger as a fallback when main access logs aren
|
|
|
253
258
|
```python
|
|
254
259
|
# Enable middleware logging
|
|
255
260
|
AIWAF_MIDDLEWARE_LOGGING = True # Enable/disable logging
|
|
256
|
-
AIWAF_MIDDLEWARE_LOG = "aiwaf_requests.log" # Log file path
|
|
257
|
-
AIWAF_MIDDLEWARE_CSV = True # Use CSV format (recommended)
|
|
258
261
|
```
|
|
259
262
|
|
|
260
263
|
**Then add middleware to MIDDLEWARE list:**
|
|
@@ -276,8 +279,8 @@ python manage.py aiwaf_logging --clear # Clear log files
|
|
|
276
279
|
|
|
277
280
|
**Benefits:**
|
|
278
281
|
- **Automatic fallback** when `AIWAF_ACCESS_LOG` unavailable
|
|
279
|
-
- **
|
|
280
|
-
- **Zero configuration** - trainer automatically detects and uses
|
|
282
|
+
- **Database storage** with precise timestamps and response times
|
|
283
|
+
- **Zero configuration** - trainer automatically detects and uses model logs
|
|
281
284
|
- **Lightweight** - fails silently to avoid breaking your application
|
|
282
285
|
|
|
283
286
|
---
|
|
@@ -386,7 +389,7 @@ python manage.py detect_and_train
|
|
|
386
389
|
```
|
|
387
390
|
|
|
388
391
|
### What happens:
|
|
389
|
-
1. Read access logs (incl. rotated or gzipped) **OR** AI-WAF middleware
|
|
392
|
+
1. Read access logs (incl. rotated or gzipped) **OR** AI-WAF middleware model logs
|
|
390
393
|
2. Auto‑block IPs with ≥ 6 total 404s
|
|
391
394
|
3. Extract features & train IsolationForest
|
|
392
395
|
4. Save `model.pkl` with current scikit-learn version
|
|
@@ -411,7 +414,7 @@ python manage.py detect_and_train
|
|
|
411
414
|
5. Extract top 10 dynamic keywords from 4xx/5xx
|
|
412
415
|
6. Remove any keywords associated with newly exempt paths
|
|
413
416
|
|
|
414
|
-
**Note:** If main access log (`AIWAF_ACCESS_LOG`) is unavailable, trainer automatically falls back to AI-WAF middleware
|
|
417
|
+
**Note:** If main access log (`AIWAF_ACCESS_LOG`) is unavailable, trainer automatically falls back to AI-WAF middleware model logs.
|
|
415
418
|
|
|
416
419
|
---
|
|
417
420
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
aiwaf/__init__.py,sha256=5uH_XGymeTFxegNihwozJE8d-Y70jvwpKhXvzZ9HkQI,220
|
|
2
|
+
aiwaf/apps.py,sha256=nCez-Ptlv2kaEk5HenA8b1pATz1VfhrHP1344gwcY1A,142
|
|
3
|
+
aiwaf/blacklist_manager.py,sha256=LYCeKFB-7e_C6Bg2WeFJWFIIQlrfRMPuGp30ivrnhQY,1196
|
|
4
|
+
aiwaf/decorators.py,sha256=IUKOdM_gdroffImRZep1g1wT6gNqD10zGwcp28hsJCs,825
|
|
5
|
+
aiwaf/middleware.py,sha256=uKGelYd7SLB37BMcR7SQ_83NIPy6n2Y17ZvTOFpAOWM,12262
|
|
6
|
+
aiwaf/middleware_logger.py,sha256=LWZVDAnjh6CGESirA8eMbhGgJKB7lVDGRQqVroH95Lo,4742
|
|
7
|
+
aiwaf/models.py,sha256=vQxgY19BDVMjoO903UNrTZC1pNoLltMU6wbyWPoAEns,2719
|
|
8
|
+
aiwaf/storage.py,sha256=z2QjAySa95FN3SPJL2GBL11tE8JYrAH6mB7BMSZ6GEM,7310
|
|
9
|
+
aiwaf/trainer.py,sha256=dOjdQ5zqEuwzffgTu7WZMokFcW5b0-KTDSjMeHBcIhw,9203
|
|
10
|
+
aiwaf/utils.py,sha256=BJk5vJCYdGPl_4QQiknjhCbkzv5HZCXgFcBJDMJpHok,3390
|
|
11
|
+
aiwaf/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
aiwaf/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
aiwaf/management/commands/add_exemption.py,sha256=U_ByfJw1EstAZ8DaSoRb97IGwYzXs0DBJkVAqeN4Wak,1128
|
|
14
|
+
aiwaf/management/commands/add_ipexemption.py,sha256=sSf3d9hGK9RqqlBYkCrnrd8KZWGT-derSpoWnEY4H60,952
|
|
15
|
+
aiwaf/management/commands/aiwaf_diagnose.py,sha256=nXFRhq66N4QC3e4scYJ2sUngJce-0yDxtBO3R2BllRM,6134
|
|
16
|
+
aiwaf/management/commands/aiwaf_logging.py,sha256=FCIqULn2tii2vD9VxL7vk3PV4k4vr7kaA00KyaCExYY,7692
|
|
17
|
+
aiwaf/management/commands/aiwaf_reset.py,sha256=0FIBqpZS8xgFFvAKJ-0zAC_-QNQwRkOHpXb8N-OdFr8,3740
|
|
18
|
+
aiwaf/management/commands/clear_cache.py,sha256=cdnuTgxkhKLqT_6k6yTcEBlREovNRQxAE51ceXlGYMA,647
|
|
19
|
+
aiwaf/management/commands/debug_csv.py,sha256=Lddqp37mIn0zdvHf4GbuNTWYyJ5h8bumDcGmFSAioi0,6801
|
|
20
|
+
aiwaf/management/commands/detect_and_train.py,sha256=-o-LZ7QZ5GeJPCekryox1DGXKMmFEkwwrcDsiM166K0,269
|
|
21
|
+
aiwaf/management/commands/diagnose_blocking.py,sha256=HKb_FdN4b6QdyqNDf54B08I5jyWfrv9Mh-SFBrr3LbU,4140
|
|
22
|
+
aiwaf/management/commands/regenerate_model.py,sha256=SUy7TCTTDJy4kRZNAbTIVBxSmljUaAC6ms0JTfSO6BE,3445
|
|
23
|
+
aiwaf/management/commands/setup_models.py,sha256=JzuxwAqO3e-8L4PdFlXkyEQmOA8EGCXBfaOwfCNv1Gg,1678
|
|
24
|
+
aiwaf/management/commands/test_exemption.py,sha256=ENmWFMJE8iQyzJGAPdw_5PUPknLajE8JjwHgH8DCFsE,5518
|
|
25
|
+
aiwaf/management/commands/test_exemption_fix.py,sha256=ngyGaHUCmQQ6y--6j4q1viZJtR-RvI526yDqvEaEXPs,2553
|
|
26
|
+
aiwaf/resources/model.pkl,sha256=5t6h9BX8yoh2xct85MXOO60jdlWyg1APskUOW0jZE1Y,1288265
|
|
27
|
+
aiwaf/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
+
aiwaf/templatetags/aiwaf_tags.py,sha256=XXfb7Tl4DjU3Sc40GbqdaqOEtKTUKELBEk58u83wBNw,357
|
|
29
|
+
aiwaf-0.1.9.0.7.dist-info/licenses/LICENSE,sha256=Ir8PX4dxgAcdB0wqNPIkw84fzIIRKE75NoUil9RX0QU,1069
|
|
30
|
+
aiwaf-0.1.9.0.7.dist-info/METADATA,sha256=rFNbBTlRRki2Prz5URgHw8yYmWTTSsxxBTeE5evUabE,13763
|
|
31
|
+
aiwaf-0.1.9.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
32
|
+
aiwaf-0.1.9.0.7.dist-info/top_level.txt,sha256=kU6EyjobT6UPCxuWpI_BvcHDG0I2tMgKaPlWzVxe2xI,6
|
|
33
|
+
aiwaf-0.1.9.0.7.dist-info/RECORD,,
|
aiwaf-0.1.9.0.5.dist-info/RECORD
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
aiwaf/__init__.py,sha256=hT1BSwKZ0GwnlbUtH7G_Ltl05PcR5VI1lS575ivkqE8,220
|
|
2
|
-
aiwaf/apps.py,sha256=nCez-Ptlv2kaEk5HenA8b1pATz1VfhrHP1344gwcY1A,142
|
|
3
|
-
aiwaf/blacklist_manager.py,sha256=6MEjzqpn-pRVM1Y8ieT3n3V28atHb7gg71RdHUFzi_g,1181
|
|
4
|
-
aiwaf/decorators.py,sha256=IUKOdM_gdroffImRZep1g1wT6gNqD10zGwcp28hsJCs,825
|
|
5
|
-
aiwaf/middleware.py,sha256=uKGelYd7SLB37BMcR7SQ_83NIPy6n2Y17ZvTOFpAOWM,12262
|
|
6
|
-
aiwaf/middleware_logger.py,sha256=v5tsiFhfdFTDBRRsfw-vfmhW2sNJx7EYRem99pgMsP0,6858
|
|
7
|
-
aiwaf/models.py,sha256=XaG1pd_oZu3y-fw66u4wblGlWcUY9gvsTNKGD0kQk7Y,1672
|
|
8
|
-
aiwaf/storage.py,sha256=iBdBaIA80_uOpKhuHCqVk8GOAK8xuLxVMj0u-j9meto,15397
|
|
9
|
-
aiwaf/trainer.py,sha256=Cem-qi1KMjfw7MFDxyxjn7nAJGPrk-I8An4HHniiT00,9877
|
|
10
|
-
aiwaf/utils.py,sha256=BJk5vJCYdGPl_4QQiknjhCbkzv5HZCXgFcBJDMJpHok,3390
|
|
11
|
-
aiwaf/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
aiwaf/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
aiwaf/management/commands/add_ipexemption.py,sha256=srgdVPDJtF7G9GGIqaZ7L3qTuNheoS_uwlhlRO4W2bc,945
|
|
14
|
-
aiwaf/management/commands/aiwaf_diagnose.py,sha256=nXFRhq66N4QC3e4scYJ2sUngJce-0yDxtBO3R2BllRM,6134
|
|
15
|
-
aiwaf/management/commands/aiwaf_logging.py,sha256=FCIqULn2tii2vD9VxL7vk3PV4k4vr7kaA00KyaCExYY,7692
|
|
16
|
-
aiwaf/management/commands/aiwaf_reset.py,sha256=0FIBqpZS8xgFFvAKJ-0zAC_-QNQwRkOHpXb8N-OdFr8,3740
|
|
17
|
-
aiwaf/management/commands/debug_csv.py,sha256=Vp55g1qWAuRUuAHoz56nuPxMrcccFCHKRGeYyui8Pxw,6794
|
|
18
|
-
aiwaf/management/commands/detect_and_train.py,sha256=-o-LZ7QZ5GeJPCekryox1DGXKMmFEkwwrcDsiM166K0,269
|
|
19
|
-
aiwaf/management/commands/regenerate_model.py,sha256=SUy7TCTTDJy4kRZNAbTIVBxSmljUaAC6ms0JTfSO6BE,3445
|
|
20
|
-
aiwaf/management/commands/test_exemption.py,sha256=qX7GMnpGFhRzC8cTtJMVN7pvjXziEWJ934cyOLN3cqs,5511
|
|
21
|
-
aiwaf/management/commands/test_exemption_fix.py,sha256=ngyGaHUCmQQ6y--6j4q1viZJtR-RvI526yDqvEaEXPs,2553
|
|
22
|
-
aiwaf/resources/model.pkl,sha256=5t6h9BX8yoh2xct85MXOO60jdlWyg1APskUOW0jZE1Y,1288265
|
|
23
|
-
aiwaf/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
-
aiwaf/templatetags/aiwaf_tags.py,sha256=XXfb7Tl4DjU3Sc40GbqdaqOEtKTUKELBEk58u83wBNw,357
|
|
25
|
-
aiwaf-0.1.9.0.5.dist-info/licenses/LICENSE,sha256=Ir8PX4dxgAcdB0wqNPIkw84fzIIRKE75NoUil9RX0QU,1069
|
|
26
|
-
aiwaf-0.1.9.0.5.dist-info/METADATA,sha256=mLQ4Bh14UOW2Wpt7MmPeaSjoBefCW5PFudhXCkrsYkc,13571
|
|
27
|
-
aiwaf-0.1.9.0.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
28
|
-
aiwaf-0.1.9.0.5.dist-info/top_level.txt,sha256=kU6EyjobT6UPCxuWpI_BvcHDG0I2tMgKaPlWzVxe2xI,6
|
|
29
|
-
aiwaf-0.1.9.0.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|