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_minutes``, default ``60``, Number of minutes 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
~~~~~~~~~~~~~~~~
Sometimes you want to change the policy for a specific view. The
``force_https``, ``frame_options``, ``frame_options_allow_from``, and
``content_security_policy`` options can be changed on a per-view basis.
.. code:: python
from flask import Flask
from flask_ipban import IpBan, ALLOW_FROM
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
=========================================
|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_minutes``, default ``60``, Number of minutes 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
~~~~~~~~~~~~~~~~
Sometimes you want to change the policy for a specific view. The
``force_https``, ``frame_options``, ``frame_options_allow_from``, and
``content_security_policy`` options can be changed on a per-view basis.
.. code:: python
from flask import Flask
from flask_ipban import IpBan, ALLOW_FROM
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
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.0.tar.gz
(4.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask-ipban-0.1.0.tar.gz.
File metadata
- Download URL: flask-ipban-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f29dc1a013388c3179603707847486c9e811012b6891fd86d7c26bc4531ab1f
|
|
| MD5 |
6fb967a3ca5a4f3425622bc6fcb1ceb6
|
|
| BLAKE2b-256 |
a56b4224e676c1e3feabdef7975daf65743a5b676d919acd0948fcd15c4d010b
|
File details
Details for the file flask_ipban-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: flask_ipban-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02d6845472d8ba517777fb9291486f2a2b9615cdcbf6002e896dd96c288ddcdf
|
|
| MD5 |
62ca763458b2ee1d061add3d5cebf2a4
|
|
| BLAKE2b-256 |
fa7dacc586deffdd7219e4e5dc22a9cb33aa4e92d80359f8e4e49eb9cb1a12a6
|