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

Twine
-----


. venv/bin/activate
twine upload --repository-url https://test.pypi.org/legacy/ dist/*


Metadata

Release files for flask-ipban 0.1.2

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.2
File Size Uploaded Provenance Actions
flask-ipban-0.1.2.tar.gz 4.8 kB Without provenance Details for flask-ipban-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 14.6 kB

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

Download URL flask-ipban-0.1.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
00aef3d60c9358310baf4e93a6cafa268b9d1e781021f207bc94ba01ca257d2f
BLAKE2b-256 checksum
How to use checksums
e5f8e3be7df3afec38b8090e66df490e57617f2a1fdd640ca63c325147759762
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.2-py2.py3-none-any.whl

Download URL flask_ipban-0.1.2-py2.py3-none-any.whl
Size 9.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
69f0731d4e207da66bf60b5c5b3a5a0374e889a76277f20fba3393c50c954c81
BLAKE2b-256 checksum
How to use checksums
25daae4919164e2488ded82f807d040534f9a2b8f7bfa2ed8129f438a3e8e431
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

Security for flask-ipban 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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