Skip to main content
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



Release files for flask-ipban 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-ipban 0.1.3
File Size Uploaded
flask-ipban-0.1.3.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-ipban 0.1.3
File Interpreter ABI Platform
flask_ipban-0.1.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 14.7 kB

Release files / flask-ipban-0.1.3.tar.gz

Download URL flask-ipban-0.1.3.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7a4622cf11f3ba06dd16b0854a2799001b983912d8ecf17b056c48a8f43939bc
BLAKE2b-256 checksum
How to use checksums
c375a3fbd23ce183a0fa6973fb5abc06435310d1ce51bf0f505209eb5a0449a3
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / flask_ipban-0.1.3-py2.py3-none-any.whl

Download URL flask_ipban-0.1.3-py2.py3-none-any.whl
Size 9.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
96c6627821244ecccf70b78865973f3968f05ffa370ebe3d913339c003684f54
BLAKE2b-256 checksum
How to use checksums
16e09b208ec8b119f82e7568196f3664ad17dc88f88826e000cee4f2da8f1236
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.13

2 release files

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.4

1 release file

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page