Skip to main content

Python bindings for libmodsecurity (OWASP ModSecurity v3)

Project description

python-modsecurity

Python bindings for libmodsecurity.

Install

pip install libmodsecurity

Usage

import libmodsecurity

engine = libmodsecurity.ModSecurity()
engine.set_connector_information("my-app/1.0")

rules = libmodsecurity.RulesSet()
rules.load(
    'SecRuleEngine On\n'
    'SecRule REQUEST_URI "@contains /admin" '
    '"id:1,phase:1,deny,status:403,log,msg:\'blocked\'"\n'
)

with engine.transaction(rules) as t:
    t.process_connection("127.0.0.1", 12345, "127.0.0.1", 80)
    t.process_uri("/admin", "GET", "1.1")
    t.add_request_header("Host", "example.com")
    t.process_request_headers()

    if it := t.intervention():
        print(f"blocked with {it.status}: {it.log}")

Project details


Download files

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

Source Distribution

libmodsecurity-3.0.15.tar.gz (20.3 kB view details)

Uploaded Source

Built Distributions

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

libmodsecurity-3.0.15-cp313-cp313-manylinux_2_28_x86_64.whl (27.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

libmodsecurity-3.0.15-cp312-cp312-manylinux_2_28_x86_64.whl (27.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

libmodsecurity-3.0.15-cp311-cp311-manylinux_2_28_x86_64.whl (27.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

libmodsecurity-3.0.15-cp310-cp310-manylinux_2_28_x86_64.whl (27.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

libmodsecurity-3.0.15-cp39-cp39-manylinux_2_28_x86_64.whl (27.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

File details

Details for the file libmodsecurity-3.0.15.tar.gz.

File metadata

  • Download URL: libmodsecurity-3.0.15.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for libmodsecurity-3.0.15.tar.gz
Algorithm Hash digest
SHA256 4d7cd12b9519bb9c00984096b82ad8a166dbe1ae0853f35eddb6f1220877cc22
MD5 4db3f7d5dae3ba6902c7d48a886c06a4
BLAKE2b-256 91cc994bd8195d149a1588d235c027783bdc8b05a610de837f0b6dbfdd27cf7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for libmodsecurity-3.0.15.tar.gz:

Publisher: wheels.yml on meirdev/python-modsecurity

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

File details

Details for the file libmodsecurity-3.0.15-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libmodsecurity-3.0.15-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5c113382891c987eaca792944604d0ebd00586847538185ce54ab08a2dab64cc
MD5 eb2e3fbe113dafbac58079703df022a9
BLAKE2b-256 6ac99dae8cb5476ba5375b8bd5a6e41013acecffe65baebbaf11aa2a3532401c

See more details on using hashes here.

Provenance

The following attestation bundles were made for libmodsecurity-3.0.15-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on meirdev/python-modsecurity

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

File details

Details for the file libmodsecurity-3.0.15-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libmodsecurity-3.0.15-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 80f6981a44c8d041ec44a0e2555bf707fa206e99a7e9170ddf9065f25fea3063
MD5 071662bee33d8c8133f349b64838f68b
BLAKE2b-256 74482a93d5b5ad8a484a2b4320b326e716f01379bb7e2ae4b379d1ab96b409f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for libmodsecurity-3.0.15-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on meirdev/python-modsecurity

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

File details

Details for the file libmodsecurity-3.0.15-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libmodsecurity-3.0.15-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 434d25f33d34f9d77c2609c3242671fe9f3f80b4433d8486cf5ba493d4b0bc4b
MD5 e762a5cab90642cd2bdc398c521c4cec
BLAKE2b-256 2a4c3f37787d5edc0e4f4fdde6fa3af31bf8f58dbfebedc08c1f4723e0319173

See more details on using hashes here.

Provenance

The following attestation bundles were made for libmodsecurity-3.0.15-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on meirdev/python-modsecurity

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

File details

Details for the file libmodsecurity-3.0.15-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libmodsecurity-3.0.15-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8e5e4066cec1dfff48b7d2391f8287caa4e44016b866fe659237afbecd1a667d
MD5 5248938f56c8998beeb5156a735013b8
BLAKE2b-256 f462b5061f46f1dcf13418f92974bacf480b1420aedc0b28e73b2aec316d32ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for libmodsecurity-3.0.15-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on meirdev/python-modsecurity

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

File details

Details for the file libmodsecurity-3.0.15-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libmodsecurity-3.0.15-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bc2eb0fd6b9857fc25bebdbb3a6f93d054fcdd17b5c37890bc62d6eac328e95e
MD5 165cb30e8b2f0c8078d365c000828181
BLAKE2b-256 e10c9e78986a92c02ad2c84d0600f80c5a22ddb8a9992e1100faafa92e612dc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for libmodsecurity-3.0.15-cp39-cp39-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on meirdev/python-modsecurity

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