https://github.com/pymodsecurity/pymodsecurity
Python Bindings for ModSecurity v3
https://github.com/pymodsecurity/pymodsecurity
bindings modsecurity python python3 security
Last synced: about 1 month ago
JSON representation
Python Bindings for ModSecurity v3
- Host: GitHub
- URL: https://github.com/pymodsecurity/pymodsecurity
- Owner: pymodsecurity
- License: apache-2.0
- Created: 2018-09-16T20:59:41.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-11-11T13:36:55.000Z (almost 2 years ago)
- Last Synced: 2024-12-13T22:28:40.879Z (10 months ago)
- Topics: bindings, modsecurity, python, python3, security
- Language: C++
- Size: 87.9 KB
- Stars: 84
- Watchers: 7
- Forks: 18
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.com/pymodsecurity/pymodsecurity)
[](https://pypi.org/project/pymodsecurity)
[](https://anaconda.org/conda-forge/pymodsecurity)
[](https://pypi.org/project/pymodsecurity)
[](https://github.com/SpiderLabs/ModSecurity/releases)# ModSecurity Python
Python binding for ModSecurity
* Note: This is an alpha version. Crashes are expected. Comments and suggestions are welcome
## Developer Guide
### Dependencies
`libmodsecurity`, `python-dev` or `python3-dev` as well as `cmake`
#### Bindings and ModSecurity Version Reference
| pymodsecurity | ModSecurity |
|--------------- |------------- |
| v0.0.1 | v3.0.2 |
| v0.0.2 | v3.0.2 |
| v0.0.3 | v3.0.2 |
| v0.0.4 | v3.0.3 |
| v0.0.5 | v3.0.3 |Please refer to [ModSecurity Releases](https://github.com/SpiderLabs/ModSecurity/releases) and [ModSecurity Installation Guide](https://github.com/SpiderLabs/ModSecurity/wiki)
### Packages
Pymodsecurity is available as an python package, to install it simply run:
```
$ pip install pymodsecurity
```### Building from source
There are multiple ways to build pymodsecurity from source, you can either compile the module manually with CMake, install using setup.py or build a conda package using the recipe. Below are steps for each way.
#### Installing via setup.py
1 - Clone this repo and update the pybind11 submodule:
```bash
$ git clone --recurse-submodules https://github.com/pymodsecurity/pymodsecurity.git
```2 - Compile and install the module:
```
$ python setup.py install
```#### Compiling with CMake
1 - Clone this repo and update the pybind11 submodule:
```bash
$ git clone --recurse-submodules https://github.com/pymodsecurity/pymodsecurity.git
```2 - Create a build directory:
```bash
$ mkdir build && cd build
```3 - Run CMake and make:
```bash
$ cmake .. && make
```
4 - Add the shared library to python's path#### Building and installing with conda
If you're using conda, you can build the package locally using conda-build (you will need to install `conda-build`).
1 - Clone this repo and update the pybind11 submodule:
```bash
$ git clone --recurse-submodules https://github.com/pymodsecurity/pymodsecurity.git
```2 - Run conda-build:
```
$ conda-build recipe
```3 - Install the package:
```
$ conda install --use-local pymodsecurity
```### Examples
Some examples are provided in the `examples/` directory. More are coming soon.
#### Real world examples
[django middleware](https://github.com/pymodsecurity/django-pymodsecurity)