HTTP spam security for Flask.
Project description
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:
pip install flask-ipban
After installing, wrap your Flask app with a IpBan:
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
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
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 Distributions
Built Distribution
File details
Details for the file flask_ipban-0.1.4-py2.py3-none-any.whl
.
File metadata
- Download URL: flask_ipban-0.1.4-py2.py3-none-any.whl
- Upload date:
- Size: 9.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 | b91c07352af7a092fd0b0f76f991769bfb4d11f60c1963057c6f59555280fe8b |
|
MD5 | 204ea48af084da08e0fe1f23c2a45f97 |
|
BLAKE2b-256 | ada33c6ef58934505eb14123a757184aee0250bf3755577355145757d8f54f5f |