HTTP spam security for Flask.
Project description
IpBan: HTTP spam security for Flask
=========================================
|PyPI Version|
IpBan is a Flask extension that can help protect against ip locations spamming url requests
against unknown pages. Often this is to search for security issues.
The default configuration:
- 50 attempts before ban
- 1 hour blocking period
Installation & Basic Usage
--------------------------
Install via `pip <https://pypi.python.org/pypi/pip>`_:
::
pip install flask-ipban
After installing, wrap your Flask app with a ``IpBan``:
.. code:: python
from flask import Flask
from flask_ipban import IpBan
app = Flask(__name__)
IpBan(app)
Enclosed is a small example application
Options
-------
- ``ban_count``, default ``50``, Number of observations before banning
- ``ban_seconds``, default ``60``, Number of seconds ip address is banned
- ``ip_ban.block(ip_address, permanent=True)`` - block the specific address forever
- ``ip_ban.add(reason='spite')`` - increase the observation for the current request ip
Per-view options
~~~~~~~~~~~~~~~~
Example code
.. code:: python
from flask import Flask
from flask_ipban import IpBan
app = Flask(__name__)
ip_ban = IpBan(app)
@app.route('/normal')
def normal():
return 'Normal'
Licensing
---------
- Apache 2.0
.. |PyPI Version| image:: https://img.shields.io/pypi/v/flask-ipban.svg
:target: https://pypi.python.org/pypi/flask-ipban
Twine
-----
. venv/bin/activate
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
=========================================
|PyPI Version|
IpBan is a Flask extension that can help protect against ip locations spamming url requests
against unknown pages. Often this is to search for security issues.
The default configuration:
- 50 attempts before ban
- 1 hour blocking period
Installation & Basic Usage
--------------------------
Install via `pip <https://pypi.python.org/pypi/pip>`_:
::
pip install flask-ipban
After installing, wrap your Flask app with a ``IpBan``:
.. code:: python
from flask import Flask
from flask_ipban import IpBan
app = Flask(__name__)
IpBan(app)
Enclosed is a small example application
Options
-------
- ``ban_count``, default ``50``, Number of observations before banning
- ``ban_seconds``, default ``60``, Number of seconds ip address is banned
- ``ip_ban.block(ip_address, permanent=True)`` - block the specific address forever
- ``ip_ban.add(reason='spite')`` - increase the observation for the current request ip
Per-view options
~~~~~~~~~~~~~~~~
Example code
.. code:: python
from flask import Flask
from flask_ipban import IpBan
app = Flask(__name__)
ip_ban = IpBan(app)
@app.route('/normal')
def normal():
return 'Normal'
Licensing
---------
- Apache 2.0
.. |PyPI Version| image:: https://img.shields.io/pypi/v/flask-ipban.svg
:target: https://pypi.python.org/pypi/flask-ipban
Twine
-----
. venv/bin/activate
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flask-ipban-0.1.2.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for flask_ipban-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69f0731d4e207da66bf60b5c5b3a5a0374e889a76277f20fba3393c50c954c81 |
|
MD5 | ec779f398b2f07797bdcb5d00092dae5 |
|
BLAKE2b-256 | 25daae4919164e2488ded82f807d040534f9a2b8f7bfa2ed8129f438a3e8e431 |