Skip to main content

Rust-powered WAF heuristics exposed to Python via PyO3

Project description

aiwaf-rust

Fast WAF heuristics and anomaly scoring implemented in Rust and exposed to Python. Designed for lightweight request validation and isolation-forest style scoring.

Install

pip install aiwaf-rust

Quickstart

from aiwaf_rust import (
    validate_headers,
    validate_url,
    validate_content,
    validate_recent,
    AiwafIsolationForest,
)

headers = {
    "user-agent": "Mozilla/5.0",
    "accept": "text/html,application/xhtml+xml",
    "accept-language": "en-US,en;q=0.9",
    "accept-encoding": "gzip, deflate",
    "connection": "keep-alive",
}

print(validate_headers(headers))
print(validate_url("https://example.com/login"))
print(validate_content("username=admin&password=..."))
print(validate_recent([{ "path": "/", "status": 200 }]))

model = AiwafIsolationForest(100, 256, 0.5, 42)
model.fit([[0.1, 0.2, 0.3], [0.2, 0.1, 0.4]])
print(model.anomaly_score([0.3, 0.2, 0.1]))

Notes

  • Built with PyO3 and abi3 so a single wheel works on Python 3.8+ (including 3.12+).
  • The WASM package is published as aiwaf-wasm on npm.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

aiwaf_rust-0.1.8-cp38-abi3-win_amd64.whl (702.6 kB view details)

Uploaded CPython 3.8+Windows x86-64

aiwaf_rust-0.1.8-cp38-abi3-manylinux_2_34_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.34+ x86-64

aiwaf_rust-0.1.8-cp38-abi3-macosx_11_0_arm64.whl (868.5 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file aiwaf_rust-0.1.8-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: aiwaf_rust-0.1.8-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 702.6 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aiwaf_rust-0.1.8-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 df8e1078326e6fa1084a815a039ec5408eecae7bd1ea0cf4a0a01db652cfb194
MD5 b4678432fbfb1d291fd0ef7dfbb29fc3
BLAKE2b-256 553bb216c04733843462f29a77d40aacb7011220db87c2ad7026b82c7ddb8c13

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiwaf_rust-0.1.8-cp38-abi3-win_amd64.whl:

Publisher: publish.yml on aiwaf-project/aiwaf-rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiwaf_rust-0.1.8-cp38-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for aiwaf_rust-0.1.8-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 27961fd5e400452160e0e1d8e5f3d40d5628c72b5d7002792e8aa05ed5ff1d28
MD5 f04ea0e258452d048810a9715bbb73aa
BLAKE2b-256 92a4e77a4059b9c3c7eea8cd65955fcc21674317dcc14c87c56f9c5b268f4304

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiwaf_rust-0.1.8-cp38-abi3-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on aiwaf-project/aiwaf-rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiwaf_rust-0.1.8-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for aiwaf_rust-0.1.8-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5157075fb9e26b763a41a7663fe5f669a2a201ad5a522c86effb3f432b23ce2f
MD5 e15b61b7ef367e098cb9443974cbc355
BLAKE2b-256 5411eb1846b15dfd06c6eee43e6a4605858f09d386b42bda7a5ee97e14ac377e

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiwaf_rust-0.1.8-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on aiwaf-project/aiwaf-rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page